diff options
author | Colin Snover | 2016-09-24 13:52:49 -0500 |
---|---|---|
committer | Colin Snover | 2016-09-29 19:39:16 -0500 |
commit | 9a64c0587bbbb68d80130149ec03a9c592bc5e2a (patch) | |
tree | afeab3fbf36d9186b43101722066f66db8e8df89 /engines/sci/graphics | |
parent | 2a27f27bb4f4ad979559e77d547cd6c8c2504f11 (diff) | |
download | scummvm-rg350-9a64c0587bbbb68d80130149ec03a9c592bc5e2a.tar.gz scummvm-rg350-9a64c0587bbbb68d80130149ec03a9c592bc5e2a.tar.bz2 scummvm-rg350-9a64c0587bbbb68d80130149ec03a9c592bc5e2a.zip |
SCI32: Always build scaler tables to the maximum possible size
This fixes rendering errors in Torin caused by the scaler table
being cut off early when cels larger than the dimensions of the
screen are scaled.
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/celobj32.cpp | 19 | ||||
-rw-r--r-- | engines/sci/graphics/celobj32.h | 11 |
2 files changed, 16 insertions, 14 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp index 27d20de637..03e2114695 100644 --- a/engines/sci/graphics/celobj32.cpp +++ b/engines/sci/graphics/celobj32.cpp @@ -35,9 +35,6 @@ namespace Sci { CelScaler *CelObj::_scaler = nullptr; void CelScaler::activateScaleTables(const Ratio &scaleX, const Ratio &scaleY) { - const int16 screenWidth = g_sci->_gfxFrameout->getCurrentBuffer().screenWidth; - const int16 screenHeight = g_sci->_gfxFrameout->getCurrentBuffer().screenHeight; - for (int i = 0; i < ARRAYSIZE(_scaleTables); ++i) { if (_scaleTables[i].scaleX == scaleX && _scaleTables[i].scaleY == scaleY) { _activeIndex = i; @@ -50,14 +47,12 @@ void CelScaler::activateScaleTables(const Ratio &scaleX, const Ratio &scaleY) { CelScalerTable &table = _scaleTables[i]; if (table.scaleX != scaleX) { - assert(screenWidth <= ARRAYSIZE(table.valuesX)); - buildLookupTable(table.valuesX, scaleX, screenWidth); + buildLookupTable(table.valuesX, scaleX, kCelScalerTableSize); table.scaleX = scaleX; } if (table.scaleY != scaleY) { - assert(screenHeight <= ARRAYSIZE(table.valuesY)); - buildLookupTable(table.valuesY, scaleY, screenHeight); + buildLookupTable(table.valuesY, scaleY, kCelScalerTableSize); table.scaleY = scaleY; } } @@ -164,8 +159,8 @@ struct SCALER_Scale { const byte *_row; READER _reader; int16 _x; - static int16 _valuesX[4096]; - static int16 _valuesY[4096]; + static int16 _valuesX[kCelScalerTableSize]; + static int16 _valuesY[kCelScalerTableSize]; SCALER_Scale(const CelObj &celObj, const Common::Rect &targetRect, const Common::Point &scaledPosition, const Ratio scaleX, const Ratio scaleY) : _row(nullptr), @@ -249,9 +244,9 @@ struct SCALER_Scale { }; template<bool FLIP, typename READER> -int16 SCALER_Scale<FLIP, READER>::_valuesX[4096]; +int16 SCALER_Scale<FLIP, READER>::_valuesX[kCelScalerTableSize]; template<bool FLIP, typename READER> -int16 SCALER_Scale<FLIP, READER>::_valuesY[4096]; +int16 SCALER_Scale<FLIP, READER>::_valuesY[kCelScalerTableSize]; #pragma mark - #pragma mark CelObj - Resource readers @@ -283,7 +278,7 @@ public: struct READER_Compressed { private: const byte *const _resource; - byte _buffer[4096]; + byte _buffer[kCelScalerTableSize]; uint32 _controlOffset; uint32 _dataOffset; uint32 _uncompressedDataOffset; diff --git a/engines/sci/graphics/celobj32.h b/engines/sci/graphics/celobj32.h index 21e86d03e0..c30529fde5 100644 --- a/engines/sci/graphics/celobj32.h +++ b/engines/sci/graphics/celobj32.h @@ -141,13 +141,20 @@ typedef Common::Array<CelCacheEntry> CelCache; #pragma mark - #pragma mark CelScaler +enum { + /** + * The maximum size of a row/column of scaled pixel data. + */ + kCelScalerTableSize = 4096 +}; + struct CelScalerTable { /** * A lookup table of indexes that should be used to find * the correct column to read from the source bitmap * when drawing a scaled version of the source bitmap. */ - int valuesX[4096]; + int valuesX[kCelScalerTableSize]; /** * The ratio used to generate the x-values. @@ -159,7 +166,7 @@ struct CelScalerTable { * the correct row to read from a source bitmap when * drawing a scaled version of the source bitmap. */ - int valuesY[4096]; + int valuesY[kCelScalerTableSize]; /** * The ratio used to generate the y-values. |