diff options
author | Martin Kiewitz | 2010-01-16 14:20:00 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-16 14:20:00 +0000 |
commit | 944774e9f5fd93e077d3c0903603cfe0b9d27389 (patch) | |
tree | 794ad0beb4798f6d77cfe322bd9ea63d45435619 /engines/sci/graphics/view.cpp | |
parent | 22e8b3ed027669496e7ebd57e23eb391e61b33cf (diff) | |
download | scummvm-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/graphics/view.cpp')
-rw-r--r-- | engines/sci/graphics/view.cpp | 20 |
1 files changed, 20 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; |