aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-16 14:20:00 +0000
committerMartin Kiewitz2010-01-16 14:20:00 +0000
commit944774e9f5fd93e077d3c0903603cfe0b9d27389 (patch)
tree794ad0beb4798f6d77cfe322bd9ea63d45435619 /engines/sci
parent22e8b3ed027669496e7ebd57e23eb391e61b33cf (diff)
downloadscummvm-rg350-944774e9f5fd93e077d3c0903603cfe0b9d27389.tar.gz
scummvm-rg350-944774e9f5fd93e077d3c0903603cfe0b9d27389.tar.bz2
scummvm-rg350-944774e9f5fd93e077d3c0903603cfe0b9d27389.zip
SCI: created getCelScaledRect() inside view class
svn-id: r47319
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/view.cpp20
-rw-r--r--engines/sci/graphics/view.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index e2bcc47ce5..5027fc5b95 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -266,6 +266,26 @@ void View::getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Comm
}
}
+void View::getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect *outRect) {
+ int16 scaledDisplaceX, scaledDisplaceY;
+ int16 scaledWidth, scaledHeight;
+ CelInfo *celInfo = getCelInfo(loopNo, celNo);
+ if (celInfo) {
+ // Scaling displaceX/Y, Width/Height
+ scaledDisplaceX = (celInfo->displaceX * scaleX) >> 7;
+ scaledDisplaceY = (celInfo->displaceY * scaleY) >> 7;
+ scaledWidth = (celInfo->width * scaleX) >> 7;
+ scaledHeight = (celInfo->height * scaleY) >> 7;
+ scaledWidth = CLIP<int16>(scaledWidth, 0, _screen->getWidth());
+ scaledHeight = CLIP<int16>(scaledHeight, 0, _screen->getHeight());
+
+ outRect->left = x + scaledDisplaceX - (scaledWidth >> 1);
+ outRect->right = outRect->left + scaledWidth;
+ outRect->bottom = y + scaledDisplaceY - z + 1;
+ outRect->top = outRect->bottom - scaledHeight;
+ }
+}
+
void View::unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint16 pixelCount) {
CelInfo *celInfo = getCelInfo(loopNo, celNo);
byte *rlePtr;
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 8c01b380b9..e648a37ca9 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -59,6 +59,7 @@ public:
CelInfo *getCelInfo(int16 loopNo, int16 celNo);
LoopInfo *getLoopInfo(int16 loopNo);
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);
uint16 getLoopCount() const { return _loopCount; }