aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorColin Snover2016-10-09 10:52:08 -0500
committerColin Snover2016-10-09 11:21:46 -0500
commit40444b0aeb11da5ccde497866bffdc80e18392b8 (patch)
treec66d4664758c1704b46bc9522d6b4cd7bb8b483c /engines/sci/graphics
parent8c555200d94470e554fb08324490dfb733952368 (diff)
downloadscummvm-rg350-40444b0aeb11da5ccde497866bffdc80e18392b8.tar.gz
scummvm-rg350-40444b0aeb11da5ccde497866bffdc80e18392b8.tar.bz2
scummvm-rg350-40444b0aeb11da5ccde497866bffdc80e18392b8.zip
SCI32: Clarify some identifiers
transparentColor -> skipColor displace -> origin scaledWidth -> xResolution scaledHeight -> yResolution
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/celobj32.cpp80
-rw-r--r--engines/sci/graphics/celobj32.h8
-rw-r--r--engines/sci/graphics/controls32.cpp2
-rw-r--r--engines/sci/graphics/cursor32.cpp2
-rw-r--r--engines/sci/graphics/frameout.cpp4
-rw-r--r--engines/sci/graphics/screen_item32.cpp76
-rw-r--r--engines/sci/graphics/text32.cpp40
-rw-r--r--engines/sci/graphics/text32.h12
8 files changed, 112 insertions, 112 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index f538bf693c..430500ce1e 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -287,7 +287,7 @@ private:
uint32 _uncompressedDataOffset;
int16 _y;
const int16 _sourceHeight;
- const uint8 _transparentColor;
+ const uint8 _skipColor;
const int16 _maxWidth;
public:
@@ -295,7 +295,7 @@ public:
_resource(celObj.getResPointer()),
_y(-1),
_sourceHeight(celObj._height),
- _transparentColor(celObj._transparentColor),
+ _skipColor(celObj._skipColor),
_maxWidth(maxWidth) {
assert(maxWidth <= celObj._width);
@@ -326,7 +326,7 @@ public:
// Fill with skip color
if (controlByte & 0x40) {
- memset(_buffer + i, _transparentColor, length);
+ memset(_buffer + i, _skipColor, length);
// Next value is fill color
} else {
memset(_buffer + i, *literal, length);
@@ -665,7 +665,7 @@ void CelObj::render(Buffer &target, const Common::Rect &targetRect, const Common
MAPPER mapper;
SCALER scaler(*this, targetRect.left - scaledPosition.x + targetRect.width(), scaledPosition);
- RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _transparentColor);
+ RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _skipColor);
renderer.draw(target, targetRect, scaledPosition);
}
@@ -675,10 +675,10 @@ void CelObj::render(Buffer &target, const Common::Rect &targetRect, const Common
MAPPER mapper;
SCALER scaler(*this, targetRect, scaledPosition, scaleX, scaleY);
if (_drawBlackLines) {
- RENDERER<MAPPER, SCALER, true> renderer(mapper, scaler, _transparentColor);
+ RENDERER<MAPPER, SCALER, true> renderer(mapper, scaler, _skipColor);
renderer.draw(target, targetRect, scaledPosition);
} else {
- RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _transparentColor);
+ RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _skipColor);
renderer.draw(target, targetRect, scaledPosition);
}
}
@@ -891,20 +891,20 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
const byte *const data = resource->data;
- _scaledWidth = READ_SCI11ENDIAN_UINT16(data + 14);
- _scaledHeight = READ_SCI11ENDIAN_UINT16(data + 16);
+ _xResolution = READ_SCI11ENDIAN_UINT16(data + 14);
+ _yResolution = READ_SCI11ENDIAN_UINT16(data + 16);
- if (_scaledWidth == 0 && _scaledHeight == 0) {
+ if (_xResolution == 0 && _yResolution == 0) {
byte sizeFlag = data[5];
if (sizeFlag == 0) {
- _scaledWidth = kLowResX;
- _scaledHeight = kLowResY;
+ _xResolution = kLowResX;
+ _yResolution = kLowResY;
} else if (sizeFlag == 1) {
- _scaledWidth = 640;
- _scaledHeight = 480;
+ _xResolution = 640;
+ _yResolution = 480;
} else if (sizeFlag == 2) {
- _scaledWidth = 640;
- _scaledHeight = 400;
+ _xResolution = 640;
+ _yResolution = 400;
}
}
@@ -958,9 +958,9 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
_width = READ_SCI11ENDIAN_UINT16(celHeader);
_height = READ_SCI11ENDIAN_UINT16(celHeader + 2);
- _displace.x = _width / 2 - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
- _displace.y = _height - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6) - 1;
- _transparentColor = celHeader[8];
+ _origin.x = _width / 2 - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
+ _origin.y = _height - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6) - 1;
+ _skipColor = celHeader[8];
_compressionType = (CelCompressionType)celHeader[9];
if (_compressionType != kCelCompressionNone && _compressionType != kCelCompressionRLE) {
@@ -989,7 +989,7 @@ bool CelObjView::analyzeUncompressedForRemap() const {
if (
pixel >= g_sci->_gfxRemap32->getStartColor() &&
pixel <= g_sci->_gfxRemap32->getEndColor() &&
- pixel != _transparentColor
+ pixel != _skipColor
) {
return true;
}
@@ -1006,7 +1006,7 @@ bool CelObjView::analyzeForRemap() const {
if (
pixel >= g_sci->_gfxRemap32->getStartColor() &&
pixel <= g_sci->_gfxRemap32->getEndColor() &&
- pixel != _transparentColor
+ pixel != _skipColor
) {
return true;
}
@@ -1080,9 +1080,9 @@ CelObjPic::CelObjPic(const GuiResourceId picId, const int16 celNo) {
_width = READ_SCI11ENDIAN_UINT16(celHeader);
_height = READ_SCI11ENDIAN_UINT16(celHeader + 2);
- _displace.x = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
- _displace.y = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6);
- _transparentColor = celHeader[8];
+ _origin.x = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
+ _origin.y = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6);
+ _skipColor = celHeader[8];
_compressionType = (CelCompressionType)celHeader[9];
_priority = READ_SCI11ENDIAN_UINT16(celHeader + 36);
_relativePosition.x = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 38);
@@ -1092,17 +1092,17 @@ CelObjPic::CelObjPic(const GuiResourceId picId, const int16 celNo) {
const uint16 sizeFlag2 = READ_SCI11ENDIAN_UINT16(data + 12);
if (sizeFlag2) {
- _scaledWidth = sizeFlag1;
- _scaledHeight = sizeFlag2;
+ _xResolution = sizeFlag1;
+ _yResolution = sizeFlag2;
} else if (sizeFlag1 == 0) {
- _scaledWidth = kLowResX;
- _scaledHeight = kLowResY;
+ _xResolution = kLowResX;
+ _yResolution = kLowResY;
} else if (sizeFlag1 == 1) {
- _scaledWidth = 640;
- _scaledHeight = 480;
+ _xResolution = 640;
+ _yResolution = 480;
} else if (sizeFlag1 == 2) {
- _scaledWidth = 640;
- _scaledHeight = 400;
+ _xResolution = 640;
+ _yResolution = 400;
}
if (celHeader[10] & 128) {
@@ -1127,7 +1127,7 @@ bool CelObjPic::analyzeUncompressedForSkip() const {
const byte *const pixels = resource + READ_SCI11ENDIAN_UINT32(resource + _celHeaderOffset + 24);
for (int i = 0; i < _width * _height; ++i) {
uint8 pixel = pixels[i];
- if (pixel == _transparentColor) {
+ if (pixel == _skipColor) {
return true;
}
}
@@ -1173,10 +1173,10 @@ CelObjMem::CelObjMem(const reg_t bitmapObject) {
_width = bitmap->getWidth();
_height = bitmap->getHeight();
- _displace = bitmap->getDisplace();
- _transparentColor = bitmap->getSkipColor();
- _scaledWidth = bitmap->getScaledWidth();
- _scaledHeight = bitmap->getScaledHeight();
+ _origin = bitmap->getOrigin();
+ _skipColor = bitmap->getSkipColor();
+ _xResolution = bitmap->getXResolution();
+ _yResolution = bitmap->getYResolution();
_hunkPaletteOffset = bitmap->getHunkPaletteOffset();
_remap = bitmap->getRemap();
}
@@ -1195,10 +1195,10 @@ byte *CelObjMem::getResPointer() const {
CelObjColor::CelObjColor(const uint8 color, const int16 width, const int16 height) {
_info.type = kCelTypeColor;
_info.color = color;
- _displace.x = 0;
- _displace.y = 0;
- _scaledWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
- _scaledHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
+ _origin.x = 0;
+ _origin.y = 0;
+ _xResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
+ _yResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
_hunkPaletteOffset = 0;
_mirrorX = false;
_remap = false;
diff --git a/engines/sci/graphics/celobj32.h b/engines/sci/graphics/celobj32.h
index c30529fde5..03d950a3c3 100644
--- a/engines/sci/graphics/celobj32.h
+++ b/engines/sci/graphics/celobj32.h
@@ -286,7 +286,7 @@ public:
/**
* TODO: Documentation
*/
- Common::Point _displace;
+ Common::Point _origin;
/**
* The dimensions of the original coordinate system for
@@ -301,21 +301,21 @@ public:
* scriptWidth/Height but seems to typically be changed
* to more closely match the native screen resolution.
*/
- uint16 _scaledWidth, _scaledHeight;
+ uint16 _xResolution, _yResolution;
/**
* The skip (transparent) color for the cel. When
* compositing, any pixels matching this color will not
* be copied to the buffer.
*/
- uint8 _transparentColor;
+ uint8 _skipColor;
/**
* Whether or not this cel has any transparent regions.
* This is used for optimised drawing of non-transparent
* cels.
*/
- bool _transparent; // TODO: probably "skip"?
+ bool _transparent;
/**
* The compression type for the pixel data for this cel.
diff --git a/engines/sci/graphics/controls32.cpp b/engines/sci/graphics/controls32.cpp
index 89997d38a5..4ec534fd8a 100644
--- a/engines/sci/graphics/controls32.cpp
+++ b/engines/sci/graphics/controls32.cpp
@@ -400,7 +400,7 @@ ScrollWindow::ScrollWindow(SegManager *segMan, const Common::Rect &gameRect, con
const uint16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
Common::Rect bitmapRect(gameRect);
- mulinc(bitmapRect, Ratio(_gfxText32._scaledWidth, scriptWidth), Ratio(_gfxText32._scaledHeight, scriptHeight));
+ mulinc(bitmapRect, Ratio(_gfxText32._xResolution, scriptWidth), Ratio(_gfxText32._yResolution, scriptHeight));
_textRect.left = 2;
_textRect.top = 2;
diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index 7889d61b09..2f2611c769 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -182,7 +182,7 @@ void GfxCursor32::setView(const GuiResourceId viewId, const int16 loopNo, const
if (_macCursorRemap.empty() && viewId != -1) {
CelObjView view(viewId, loopNo, celNo);
- _hotSpot = view._displace;
+ _hotSpot = view._origin;
_width = view._width;
_height = view._height;
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index c5c06c68d4..94518413da 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -1344,7 +1344,7 @@ bool GfxFrameout::isOnMe(const ScreenItem &screenItem, const Plane &plane, const
scaledPosition.x -= screenItem._scaledPosition.x;
scaledPosition.y -= screenItem._scaledPosition.y;
- mulru(scaledPosition, Ratio(celObj._scaledWidth, _currentBuffer.screenWidth), Ratio(celObj._scaledHeight, _currentBuffer.screenHeight));
+ mulru(scaledPosition, Ratio(celObj._xResolution, _currentBuffer.screenWidth), Ratio(celObj._yResolution, _currentBuffer.screenHeight));
if (screenItem._scale.signal != kScaleSignalNone && screenItem._scale.x && screenItem._scale.y) {
scaledPosition.x = scaledPosition.x * 128 / screenItem._scale.x;
@@ -1352,7 +1352,7 @@ bool GfxFrameout::isOnMe(const ScreenItem &screenItem, const Plane &plane, const
}
uint8 pixel = celObj.readPixel(scaledPosition.x, scaledPosition.y, mirrorX);
- return pixel != celObj._transparentColor;
+ return pixel != celObj._skipColor;
}
return true;
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index 0956ef71a4..9b0d390cc3 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -275,18 +275,18 @@ void ScreenItem::calcRects(const Plane &plane) {
if (scaleX.getNumerator() && scaleY.getNumerator()) {
_screenItemRect = _insetRect;
- const Ratio celToScreenX(screenWidth, celObj._scaledWidth);
- const Ratio celToScreenY(screenHeight, celObj._scaledHeight);
+ const Ratio celToScreenX(screenWidth, celObj._xResolution);
+ const Ratio celToScreenY(screenHeight, celObj._yResolution);
// Cel may use a coordinate system that is not the same size as the
// script coordinate system (usually this means high-resolution
// pictures with low-resolution scripts)
- if (celObj._scaledWidth != kLowResX || celObj._scaledHeight != kLowResY) {
+ if (celObj._xResolution != kLowResX || celObj._yResolution != kLowResY) {
// high resolution coordinates
if (_useInsetRect) {
- const Ratio scriptToCelX(celObj._scaledWidth, scriptWidth);
- const Ratio scriptToCelY(celObj._scaledHeight, scriptHeight);
+ const Ratio scriptToCelX(celObj._xResolution, scriptWidth);
+ const Ratio scriptToCelY(celObj._yResolution, scriptHeight);
mulru(_screenItemRect, scriptToCelX, scriptToCelY, 0);
if (_screenItemRect.intersects(celRect)) {
@@ -296,11 +296,11 @@ void ScreenItem::calcRects(const Plane &plane) {
}
}
- int displaceX = celObj._displace.x;
- int displaceY = celObj._displace.y;
+ int originX = celObj._origin.x;
+ int originY = celObj._origin.y;
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
- displaceX = celObj._width - celObj._displace.x - 1;
+ originX = celObj._width - celObj._origin.x - 1;
}
if (!scaleX.isOne() || !scaleY.isOne()) {
@@ -328,13 +328,13 @@ void ScreenItem::calcRects(const Plane &plane) {
}
}
- displaceX = (displaceX * scaleX).toInt();
- displaceY = (displaceY * scaleY).toInt();
+ originX = (originX * scaleX).toInt();
+ originY = (originY * scaleY).toInt();
}
mulinc(_screenItemRect, celToScreenX, celToScreenY);
- displaceX = (displaceX * celToScreenX).toInt();
- displaceY = (displaceY * celToScreenY).toInt();
+ originX = (originX * celToScreenX).toInt();
+ originY = (originY * celToScreenY).toInt();
const Ratio scriptToScreenX = Ratio(screenWidth, scriptWidth);
const Ratio scriptToScreenY = Ratio(screenHeight, scriptHeight);
@@ -343,8 +343,8 @@ void ScreenItem::calcRects(const Plane &plane) {
_scaledPosition.x = _position.x;
_scaledPosition.y = _position.y;
} else {
- _scaledPosition.x = (_position.x * scriptToScreenX).toInt() - displaceX;
- _scaledPosition.y = (_position.y * scriptToScreenY).toInt() - displaceY;
+ _scaledPosition.x = (_position.x * scriptToScreenX).toInt() - originX;
+ _scaledPosition.y = (_position.y * scriptToScreenY).toInt() - originY;
}
_screenItemRect.translate(_scaledPosition.x, _scaledPosition.y);
@@ -362,7 +362,7 @@ void ScreenItem::calcRects(const Plane &plane) {
if (celObjPic == nullptr) {
error("Expected a CelObjPic");
}
- temp.translate((celObjPic->_relativePosition.x * scriptToScreenX).toInt() - displaceX, 0);
+ temp.translate((celObjPic->_relativePosition.x * scriptToScreenX).toInt() - originX, 0);
// TODO: This is weird.
int deltaX = plane._planeRect.width() - temp.right - 1 - temp.left;
@@ -380,9 +380,9 @@ void ScreenItem::calcRects(const Plane &plane) {
} else {
// low resolution coordinates
- int displaceX = celObj._displace.x;
+ int originX = celObj._origin.x;
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
- displaceX = celObj._width - celObj._displace.x - 1;
+ originX = celObj._width - celObj._origin.x - 1;
}
if (!scaleX.isOne() || !scaleY.isOne()) {
@@ -394,8 +394,8 @@ void ScreenItem::calcRects(const Plane &plane) {
_screenItemRect.bottom -= 1;
}
- _scaledPosition.x = _position.x - (displaceX * scaleX).toInt();
- _scaledPosition.y = _position.y - (celObj._displace.y * scaleY).toInt();
+ _scaledPosition.x = _position.x - (originX * scaleX).toInt();
+ _scaledPosition.y = _position.y - (celObj._origin.y * scaleY).toInt();
_screenItemRect.translate(_scaledPosition.x, _scaledPosition.y);
if (_mirrorX != celObj._mirrorX && _celInfo.type == kCelTypePic) {
@@ -410,7 +410,7 @@ void ScreenItem::calcRects(const Plane &plane) {
if (celObjPic == nullptr) {
error("Expected a CelObjPic");
}
- temp.translate(celObjPic->_relativePosition.x - (displaceX * scaleX).toInt(), celObjPic->_relativePosition.y - (celObj._displace.y * scaleY).toInt());
+ temp.translate(celObjPic->_relativePosition.x - (originX * scaleX).toInt(), celObjPic->_relativePosition.y - (celObj._origin.y * scaleY).toInt());
// TODO: This is weird.
int deltaX = plane._gameRect.width() - temp.right - 1 - temp.left;
@@ -423,7 +423,7 @@ void ScreenItem::calcRects(const Plane &plane) {
_scaledPosition.y += plane._gameRect.top;
_screenItemRect.translate(plane._gameRect.left, plane._gameRect.top);
- if (celObj._scaledWidth != screenWidth || celObj._scaledHeight != screenHeight) {
+ if (celObj._xResolution != screenWidth || celObj._yResolution != screenHeight) {
mulru(_scaledPosition, celToScreenX, celToScreenY);
mulru(_screenItemRect, celToScreenX, celToScreenY, 1);
}
@@ -517,11 +517,11 @@ void ScreenItem::printDebugInfo(Console *con) const {
_celInfo.color
);
if (_celObj != nullptr) {
- con->debugPrintf(" width %d, height %d, scaledWidth %d, scaledHeight %d\n",
+ con->debugPrintf(" width %d, height %d, x-resolution %d, y-resolution %d\n",
_celObj->_width,
_celObj->_height,
- _celObj->_scaledWidth,
- _celObj->_scaledHeight
+ _celObj->_xResolution,
+ _celObj->_yResolution
);
}
}
@@ -603,19 +603,19 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
return Common::Rect();
}
- int16 displaceX = celObj._displace.x;
- int16 displaceY = celObj._displace.y;
+ int16 originX = celObj._origin.x;
+ int16 originY = celObj._origin.y;
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
- displaceX = celObj._width - displaceX - 1;
+ originX = celObj._width - originX - 1;
}
- if (celObj._scaledWidth != kLowResX || celObj._scaledHeight != kLowResY) {
+ if (celObj._xResolution != kLowResX || celObj._yResolution != kLowResY) {
// high resolution coordinates
if (_useInsetRect) {
- Ratio scriptToCelX(celObj._scaledWidth, scriptWidth);
- Ratio scriptToCelY(celObj._scaledHeight, scriptHeight);
+ Ratio scriptToCelX(celObj._xResolution, scriptWidth);
+ Ratio scriptToCelY(celObj._yResolution, scriptHeight);
mulru(nsRect, scriptToCelX, scriptToCelY, 0);
if (nsRect.intersects(celObjRect)) {
@@ -656,14 +656,14 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
}
}
- Ratio celToScriptX(scriptWidth, celObj._scaledWidth);
- Ratio celToScriptY(scriptHeight, celObj._scaledHeight);
+ Ratio celToScriptX(scriptWidth, celObj._xResolution);
+ Ratio celToScriptY(scriptHeight, celObj._yResolution);
- displaceX = (displaceX * scaleX * celToScriptX).toInt();
- displaceY = (displaceY * scaleY * celToScriptY).toInt();
+ originX = (originX * scaleX * celToScriptX).toInt();
+ originY = (originY * scaleY * celToScriptY).toInt();
mulinc(nsRect, celToScriptX, celToScriptY);
- nsRect.translate(_position.x - displaceX, _position.y - displaceY);
+ nsRect.translate(_position.x - originX, _position.y - originY);
} else {
// low resolution coordinates
@@ -676,9 +676,9 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
nsRect.bottom -= 1;
}
- displaceX = (displaceX * scaleX).toInt();
- displaceY = (displaceY * scaleY).toInt();
- nsRect.translate(_position.x - displaceX, _position.y - displaceY);
+ originX = (originX * scaleX).toInt();
+ originY = (originY * scaleY).toInt();
+ nsRect.translate(_position.x - originX, _position.y - originY);
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
nsRect.translate(plane._gameRect.width() - nsRect.width(), 0);
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 254c7d92e6..d142ff75c3 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -39,8 +39,8 @@
namespace Sci {
int16 GfxText32::_defaultFontId = 0;
-int16 GfxText32::_scaledWidth = 0;
-int16 GfxText32::_scaledHeight = 0;
+int16 GfxText32::_xResolution = 0;
+int16 GfxText32::_yResolution = 0;
GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts) :
_segMan(segMan),
@@ -52,10 +52,10 @@ GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts) :
_fontId = _defaultFontId;
_font = _cache->getFont(_defaultFontId);
- if (_scaledWidth == 0) {
+ if (_xResolution == 0) {
// initialize the statics
- _scaledWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
- _scaledHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
+ _xResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
+ _yResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
}
}
@@ -78,8 +78,8 @@ reg_t GfxText32::createFontBitmap(int16 width, int16 height, const Common::Rect
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- Ratio scaleX(_scaledWidth, scriptWidth);
- Ratio scaleY(_scaledHeight, scriptHeight);
+ Ratio scaleX(_xResolution, scriptWidth);
+ Ratio scaleY(_yResolution, scriptHeight);
_width = (_width * scaleX).toInt();
_height = (_height * scaleY).toInt();
@@ -96,7 +96,7 @@ reg_t GfxText32::createFontBitmap(int16 width, int16 height, const Common::Rect
_textRect = Common::Rect();
}
- _segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false, gc);
+ _segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _xResolution, _yResolution, 0, false, gc);
erase(bitmapRect, false);
@@ -120,12 +120,12 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- mulinc(_textRect, Ratio(_scaledWidth, scriptWidth), Ratio(_scaledHeight, scriptHeight));
+ mulinc(_textRect, Ratio(_xResolution, scriptWidth), Ratio(_yResolution, scriptHeight));
CelObjView view(celInfo.resourceId, celInfo.loopNo, celInfo.celNo);
- _skipColor = view._transparentColor;
- _width = view._width * _scaledWidth / view._scaledWidth;
- _height = view._height * _scaledHeight / view._scaledHeight;
+ _skipColor = view._skipColor;
+ _width = view._width * _xResolution / view._xResolution;
+ _height = view._height * _yResolution / view._yResolution;
Common::Rect bitmapRect(_width, _height);
if (_textRect.intersects(bitmapRect)) {
@@ -134,7 +134,7 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &
_textRect = Common::Rect();
}
- SciBitmap &bitmap = *_segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false, gc);
+ SciBitmap &bitmap = *_segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _xResolution, _yResolution, 0, false, gc);
// NOTE: The engine filled the bitmap pixels with 11 here, which is silly
// because then it just erased the bitmap using the skip color. So we don't
@@ -144,7 +144,7 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &
erase(bitmapRect, false);
_backColor = backColor;
- view.draw(bitmap.getBuffer(), bitmapRect, Common::Point(0, 0), false, Ratio(_scaledWidth, view._scaledWidth), Ratio(_scaledHeight, view._scaledHeight));
+ view.draw(bitmap.getBuffer(), bitmapRect, Common::Point(0, 0), false, Ratio(_xResolution, view._xResolution), Ratio(_yResolution, view._yResolution));
if (_backColor != skipColor && _foreColor != skipColor) {
erase(_textRect, false);
@@ -332,7 +332,7 @@ void GfxText32::drawText(const uint index, uint length) {
void GfxText32::invertRect(const reg_t bitmapId, int16 bitmapStride, const Common::Rect &rect, const uint8 foreColor, const uint8 backColor, const bool doScaling) {
Common::Rect targetRect = rect;
if (doScaling) {
- bitmapStride = bitmapStride * _scaledWidth / g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
+ bitmapStride = bitmapStride * _xResolution / g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
targetRect = scaleRect(rect);
}
@@ -557,13 +557,13 @@ Common::Rect GfxText32::getTextSize(const Common::String &text, int16 maxWidth,
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- maxWidth = maxWidth * _scaledWidth / scriptWidth;
+ maxWidth = maxWidth * _xResolution / scriptWidth;
_text = text;
if (maxWidth >= 0) {
if (maxWidth == 0) {
- maxWidth = _scaledWidth * 3 / 5;
+ maxWidth = _xResolution * 3 / 5;
}
result.right = maxWidth;
@@ -606,8 +606,8 @@ Common::Rect GfxText32::getTextSize(const Common::String &text, int16 maxWidth,
if (doScaling) {
// NOTE: The original engine code also scaled top/left but these are
// always zero so there is no reason to do that.
- result.right = ((result.right - 1) * scriptWidth + _scaledWidth - 1) / _scaledWidth + 1;
- result.bottom = ((result.bottom - 1) * scriptHeight + _scaledHeight - 1) / _scaledHeight + 1;
+ result.right = ((result.right - 1) * scriptWidth + _xResolution - 1) / _xResolution + 1;
+ result.bottom = ((result.bottom - 1) * scriptHeight + _yResolution - 1) / _yResolution + 1;
}
return result;
@@ -630,7 +630,7 @@ int16 GfxText32::getTextCount(const Common::String &text, const uint index, cons
Common::Rect scaledRect(textRect);
if (doScaling) {
- mulinc(scaledRect, Ratio(_scaledWidth, scriptWidth), Ratio(_scaledHeight, scriptHeight));
+ mulinc(scaledRect, Ratio(_xResolution, scriptWidth), Ratio(_yResolution, scriptHeight));
}
Common::String oldText = _text;
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 44bd48afd5..c4521a4f56 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -151,8 +151,8 @@ private:
Common::Rect scaledRect(rect);
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- Ratio scaleX(_scaledWidth, scriptWidth);
- Ratio scaleY(_scaledHeight, scriptHeight);
+ Ratio scaleX(_xResolution, scriptWidth);
+ Ratio scaleY(_yResolution, scriptHeight);
mulinc(scaledRect, scaleX, scaleY);
return scaledRect;
}
@@ -169,13 +169,13 @@ public:
* The size of the x-dimension of the coordinate system
* used by the text renderer. Static since it was global in SSCI.
*/
- static int16 _scaledWidth;
+ static int16 _xResolution;
/**
* The size of the y-dimension of the coordinate system
* used by the text renderer. Static since it was global in SSCI.
*/
- static int16 _scaledHeight;
+ static int16 _yResolution;
/**
* The currently active font resource used to write text
@@ -199,12 +199,12 @@ public:
inline int scaleUpWidth(int value) const {
const int scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
- return (value * scriptWidth + _scaledWidth - 1) / _scaledWidth;
+ return (value * scriptWidth + _xResolution - 1) / _xResolution;
}
inline int scaleUpHeight(int value) const {
const int scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- return (value * scriptHeight + _scaledHeight - 1) / _scaledHeight;
+ return (value * scriptHeight + _yResolution - 1) / _yResolution;
}
/**