diff options
author | Martin Kiewitz | 2010-01-16 16:17:45 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-16 16:17:45 +0000 |
commit | e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005 (patch) | |
tree | 6ed188889bf508987d01f62ed49714597d84dd58 /engines/sci/graphics/view.cpp | |
parent | 220c118a8fd4459e8947b3896bef386dc8fe51c7 (diff) | |
download | scummvm-rg350-e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005.tar.gz scummvm-rg350-e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005.tar.bz2 scummvm-rg350-e29c4e7af7b925bf5d04d80fa7deaaf8bcaa4005.zip |
SCI: View::drawScaled() created (doesnt do scaling yet), removed scaling variables from View::draw, gfx calls drawScaled() when scaleX/Y != 128, getting scaled rect inside kAnimate()
svn-id: r47322
Diffstat (limited to 'engines/sci/graphics/view.cpp')
-rw-r--r-- | engines/sci/graphics/view.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 5027fc5b95..42f1d42777 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -480,7 +480,7 @@ void View::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clear } } -void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleX, uint16 scaleY) { +void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires) { Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; CelInfo *celInfo = getCelInfo(loopNo, celNo); byte *bitmap = getBitmap(loopNo, celNo); @@ -527,6 +527,40 @@ void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectT } } +void View::drawScaled(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY) { + Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette; + CelInfo *celInfo = getCelInfo(loopNo, celNo); + byte *bitmap = getBitmap(loopNo, celNo); + int16 celHeight = celInfo->height, celWidth = celInfo->width; + int16 width, height; + byte clearKey = celInfo->clearKey; + byte color; + byte drawMask = priority == 255 ? SCI_SCREEN_MASK_VISUAL : SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY; + int x, y; + + if (_embeddedPal) { + // Merge view palette in... + _palette->set(&_viewPalette, 1); + } + + width = MIN(clipRect.width(), celWidth); + height = MIN(clipRect.height(), celHeight); + + // Calculate scale table + // TODO + + bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left); + + for (y = 0; y < height; y++, bitmap += celWidth) { + for (x = 0; x < width; x++) { + color = bitmap[x]; + if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, clipRectTranslated.top + y)) { + _screen->putPixel(clipRectTranslated.left + x, clipRectTranslated.top + y, drawMask, palette->mapping[color], priority, 0); + } + } + } +} + uint16 View::getCelCount(int16 loopNo) { if ((loopNo < 0) || (loopNo >= _loopCount)) return 0; |