From ae88f41596b1331496db4dce30e84d5948244518 Mon Sep 17 00:00:00 2001 From: md5 Date: Sun, 20 Feb 2011 12:20:40 +0200 Subject: SCI: Slight cleanup --- engines/sci/graphics/paint16.cpp | 8 +++----- engines/sci/graphics/view.cpp | 17 ++++++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index 0bb3fc85c5..935dd4e62e 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -121,11 +121,10 @@ void GfxPaint16::drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common: Common::Rect clipRectTranslated = clipRect; _ports->offsetRect(clipRectTranslated); - if (scaleX == 128 && scaleY == 128) { + if (scaleX == 128 && scaleY == 128) view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false); - } else { + else view->drawScaled(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, scaleX, scaleY); - } } // This is used as replacement for drawCelAndShow() when hires-cels are drawn to @@ -278,9 +277,8 @@ void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte color, } void GfxPaint16::frameRect(const Common::Rect &rect) { - Common::Rect r; + Common::Rect r = rect; // left - r = rect; r.right = rect.left + 1; paintRect(r); // right diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index a8fc8e7f15..3c1f417740 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -346,12 +346,9 @@ void GfxView::getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, C void GfxView::getCelSpecialHoyle4Rect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect &outRect) const { const CelInfo *celInfo = getCelInfo(loopNo, celNo); - int16 adjustY = y - celInfo->height + celInfo->displaceY + 1; - int16 adjustX = x - ((celInfo->width - 1) >> 1) + celInfo->displaceX; - outRect.top += adjustY; - outRect.bottom += adjustY; - outRect.left += adjustX; - outRect.right += adjustX; + int16 adjustY = y + celInfo->displaceY - celInfo->height + 1; + int16 adjustX = x + celInfo->displaceX - ((celInfo->width - 1) >> 1); + outRect.translate(adjustX, adjustY); } void GfxView::getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect &outRect) const { @@ -655,10 +652,9 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const const byte drawMask = (priority == 255) ? GFX_SCREEN_MASK_VISUAL : GFX_SCREEN_MASK_VISUAL|GFX_SCREEN_MASK_PRIORITY; int x, y; - if (_embeddedPal) { + if (_embeddedPal) // Merge view palette in... _palette->set(&_viewPalette, false); - } const int16 width = MIN(clipRect.width(), celWidth); const int16 height = MIN(clipRect.height(), celHeight); @@ -679,7 +675,7 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const // UpscaledHires means view is hires and is supposed to // get drawn onto lowres screen. // FIXME(?): we can't read priority directly with the - // hires coordinates. may not be needed at all in kq6 + // hires coordinates. May not be needed at all in kq6 _screen->putPixelOnDisplay(x2, y2, palette->mapping[color]); } } @@ -718,10 +714,9 @@ void GfxView::drawScaled(const Common::Rect &rect, const Common::Rect &clipRect, int16 scaledWidth, scaledHeight; int pixelNo, scaledPixel, scaledPixelNo, prevScaledPixelNo; - if (_embeddedPal) { + if (_embeddedPal) // Merge view palette in... _palette->set(&_viewPalette, false); - } scaledWidth = (celInfo->width * scaleX) >> 7; scaledHeight = (celInfo->height * scaleY) >> 7; -- cgit v1.2.3