diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/view.cpp | 20 | ||||
-rw-r--r-- | engines/sci/graphics/view.h | 1 |
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; } |