[Scummvm-cvs-logs] SF.net SVN: scummvm:[47325] scummvm/trunk/engines/sci/graphics/view.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sat Jan 16 18:30:17 CET 2010
Revision: 47325
http://scummvm.svn.sourceforge.net/scummvm/?rev=47325&view=rev
Author: m_kiewitz
Date: 2010-01-16 17:30:17 +0000 (Sat, 16 Jan 2010)
Log Message:
-----------
SCI: scaling support, upscaling not yet supported - not really tested, so there may be bugs
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/view.cpp
Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp 2010-01-16 16:54:54 UTC (rev 47324)
+++ scummvm/trunk/engines/sci/graphics/view.cpp 2010-01-16 17:30:17 UTC (rev 47325)
@@ -532,28 +532,55 @@
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;
+ uint16 scalingX[320];
+ uint16 scalingY[200];
+ uint16 scaledWidth, scaledHeight;
+ int16 pixelNo, scaledPixel;
+ uint16 offsetX, offsetY;
if (_embeddedPal) {
// Merge view palette in...
_palette->set(&_viewPalette, 1);
}
- width = MIN(clipRect.width(), celWidth);
- height = MIN(clipRect.height(), celHeight);
+ scaledWidth = (celInfo->width * scaleX) >> 7;
+ scaledHeight = (celInfo->height * scaleY) >> 7;
+ scaledWidth = CLIP<int16>(scaledWidth, 0, _screen->getWidth());
+ scaledHeight = CLIP<int16>(scaledHeight, 0, _screen->getHeight());
- // Calculate scale table
- // TODO
+ if ((scaleX > 128) || (scaleY > 128)) {
+ warning("upscaling doesnt work yet");
+ return;
+ }
- bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left);
+ // Create height scaling table
+ pixelNo = 0;
+ scaledPixel = 0;
+ while (pixelNo < celHeight) {
+ scalingY[scaledPixel >> 7] = pixelNo;
+ pixelNo++;
+ scaledPixel += scaleY;
+ }
- for (y = 0; y < height; y++, bitmap += celWidth) {
- for (x = 0; x < width; x++) {
- color = bitmap[x];
+ // Create width scaling table
+ pixelNo = 0;
+ scaledPixel = 0;
+ while (pixelNo < celWidth) {
+ scalingX[scaledPixel >> 7] = pixelNo;
+ pixelNo++;
+ scaledPixel += scaleX;
+ }
+
+ offsetY = clipRect.top - rect.top;
+ offsetX = clipRect.left - rect.left;
+
+ for (y = 0; y < scaledHeight; y++) {
+ for (x = 0; x < scaledWidth; x++) {
+ color = bitmap[scalingY[y] * celWidth + scalingX[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);
}
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