aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-16 17:30:17 +0000
committerMartin Kiewitz2010-01-16 17:30:17 +0000
commitd1733bcf1526060e19411cbc6ddca8e1f772cfc6 (patch)
treede0cb34a390fd89a43059a23a959f207b156a7a7 /engines/sci
parent5437bf9cdae49b86eab4053fead633478576d860 (diff)
downloadscummvm-rg350-d1733bcf1526060e19411cbc6ddca8e1f772cfc6.tar.gz
scummvm-rg350-d1733bcf1526060e19411cbc6ddca8e1f772cfc6.tar.bz2
scummvm-rg350-d1733bcf1526060e19411cbc6ddca8e1f772cfc6.zip
SCI: scaling support, upscaling not yet supported - not really tested, so there may be bugs
svn-id: r47325
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/view.cpp45
1 files changed, 36 insertions, 9 deletions
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 42f1d42777..3ba609982b 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -532,28 +532,55 @@ void View::drawScaled(Common::Rect rect, Common::Rect clipRect, Common::Rect cli
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());
+
+ if ((scaleX > 128) || (scaleY > 128)) {
+ warning("upscaling doesnt work yet");
+ return;
+ }
- // Calculate scale table
- // TODO
+ // Create height scaling table
+ pixelNo = 0;
+ scaledPixel = 0;
+ while (pixelNo < celHeight) {
+ scalingY[scaledPixel >> 7] = pixelNo;
+ pixelNo++;
+ scaledPixel += scaleY;
+ }
- bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left);
+ // 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 < height; y++, bitmap += celWidth) {
- for (x = 0; x < width; x++) {
- color = bitmap[x];
+ 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);
}