[Scummvm-cvs-logs] SF.net SVN: scummvm:[47322] scummvm/trunk/engines/sci/graphics
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sat Jan 16 17:17:45 CET 2010
Revision: 47322
http://scummvm.svn.sourceforge.net/scummvm/?rev=47322&view=rev
Author: m_kiewitz
Date: 2010-01-16 16:17:45 +0000 (Sat, 16 Jan 2010)
Log Message:
-----------
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()
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/animate.cpp
scummvm/trunk/engines/sci/graphics/gfx.cpp
scummvm/trunk/engines/sci/graphics/view.cpp
scummvm/trunk/engines/sci/graphics/view.h
Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp 2010-01-16 16:06:41 UTC (rev 47321)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp 2010-01-16 16:17:45 UTC (rev 47322)
@@ -217,7 +217,11 @@
}
// Create rect according to coordinates and given cel
- view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, &listEntry->celRect);
+ if (listEntry->scaleSignal & kScaleSignalDoScaling) {
+ view->getCelScaledRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, listEntry->scaleX, listEntry->scaleY, &listEntry->celRect);
+ } else {
+ view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, &listEntry->celRect);
+ }
PUT_SEL32V(_s->_segMan, curObject, nsLeft, listEntry->celRect.left);
PUT_SEL32V(_s->_segMan, curObject, nsTop, listEntry->celRect.top);
PUT_SEL32V(_s->_segMan, curObject, nsRight, listEntry->celRect.right);
Modified: scummvm/trunk/engines/sci/graphics/gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.cpp 2010-01-16 16:06:41 UTC (rev 47321)
+++ scummvm/trunk/engines/sci/graphics/gfx.cpp 2010-01-16 16:17:45 UTC (rev 47322)
@@ -382,7 +382,11 @@
Common::Rect clipRectTranslated = clipRect;
OffsetRect(clipRectTranslated);
- view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false, scaleX, scaleY);
+ if (scaleX == 128 && scaleY == 128) {
+ view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false);
+ } else {
+ view->drawScaled(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, scaleX, scaleY);
+ }
}
// This is used as replacement for drawCelAndShow() when hires-cels are drawn to screen
@@ -429,7 +433,7 @@
clipRectTranslated.left += curPortPos.x; clipRectTranslated.right += curPortPos.x;
}
- view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true, scaleX, scaleY);
+ view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true);
if (!_screen->_picNotValidSci11) {
_screen->copyDisplayRectToScreen(clipRectTranslated);
}
Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp 2010-01-16 16:06:41 UTC (rev 47321)
+++ scummvm/trunk/engines/sci/graphics/view.cpp 2010-01-16 16:17:45 UTC (rev 47322)
@@ -480,7 +480,7 @@
}
}
-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::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;
Modified: scummvm/trunk/engines/sci/graphics/view.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.h 2010-01-16 16:06:41 UTC (rev 47321)
+++ scummvm/trunk/engines/sci/graphics/view.h 2010-01-16 16:17:45 UTC (rev 47322)
@@ -61,7 +61,8 @@
void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect *outRect);
byte *getBitmap(int16 loopNo, int16 celNo);
- void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleX = 128, uint16 scaleY = 128);
+ void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires);
+ void drawScaled(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, int16 scaleX, int16 scaleY);
uint16 getLoopCount() const { return _loopCount; }
uint16 getCelCount(int16 loopNo);
Palette *getPalette();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list