aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorColin Snover2016-07-29 15:48:14 -0500
committerColin Snover2016-08-01 10:37:14 -0500
commit2071196f4235c75ff020605f53b3d397532e841a (patch)
treeaaae025e3e221e29e7d0c2f2b9c48f4e760caf6e /engines/sci/graphics
parent4e31c9aaf4aa36b6fea039d1779317e6a943e68b (diff)
downloadscummvm-rg350-2071196f4235c75ff020605f53b3d397532e841a.tar.gz
scummvm-rg350-2071196f4235c75ff020605f53b3d397532e841a.tar.bz2
scummvm-rg350-2071196f4235c75ff020605f53b3d397532e841a.zip
SCI32: Add bitmap segment and remove GC option from hunk segment
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/celobj32.cpp4
-rw-r--r--engines/sci/graphics/controls32.cpp4
-rw-r--r--engines/sci/graphics/paint16.cpp2
-rw-r--r--engines/sci/graphics/paint32.cpp20
-rw-r--r--engines/sci/graphics/paint32.h6
-rw-r--r--engines/sci/graphics/palette.cpp2
-rw-r--r--engines/sci/graphics/text32.cpp26
-rw-r--r--engines/sci/graphics/text32.h204
-rw-r--r--engines/sci/graphics/transitions32.cpp11
-rw-r--r--engines/sci/graphics/video32.cpp7
10 files changed, 42 insertions, 244 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index a3dcbbbab6..311684d595 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -1088,7 +1088,7 @@ CelObjMem::CelObjMem(const reg_t bitmapObject) {
_celHeaderOffset = 0;
_transparent = true;
- BitmapResource bitmap(bitmapObject);
+ SciBitmap &bitmap = *g_sci->getEngineState()->_segMan->lookupBitmap(bitmapObject);
_width = bitmap.getWidth();
_height = bitmap.getHeight();
_displace = bitmap.getDisplace();
@@ -1104,7 +1104,7 @@ CelObjMem *CelObjMem::duplicate() const {
}
byte *CelObjMem::getResPointer() const {
- return g_sci->getEngineState()->_segMan->getHunkPointer(_info.bitmap);
+ return g_sci->getEngineState()->_segMan->lookupBitmap(_info.bitmap)->getRawData();
}
#pragma mark -
diff --git a/engines/sci/graphics/controls32.cpp b/engines/sci/graphics/controls32.cpp
index 639a35c1a6..7689655d1d 100644
--- a/engines/sci/graphics/controls32.cpp
+++ b/engines/sci/graphics/controls32.cpp
@@ -309,7 +309,7 @@ reg_t GfxControls32::kernelEditText(const reg_t controlObject) {
g_sci->_gfxFrameout->frameOut(true);
}
- _segMan->freeHunkEntry(editor.bitmap);
+ _segMan->freeBitmap(editor.bitmap);
if (textChanged) {
editor.text.trim();
@@ -419,7 +419,7 @@ ScrollWindow::ScrollWindow(SegManager *segMan, const Common::Rect &gameRect, con
}
ScrollWindow::~ScrollWindow() {
- _segMan->freeHunkEntry(_bitmap);
+ _segMan->freeBitmap(_bitmap);
// _screenItem will be deleted by GfxFrameout
}
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 4517659283..6004e9ce7a 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -334,7 +334,7 @@ reg_t GfxPaint16::bitsSave(const Common::Rect &rect, byte screenMask) {
// now actually ask _screen how much space it will need for saving
size = _screen->bitsGetDataSize(workerRect, screenMask);
- memoryId = _segMan->allocateHunkEntry("SaveBits()", size, true);
+ memoryId = _segMan->allocateHunkEntry("SaveBits()", size);
memoryPtr = _segMan->getHunkPointer(memoryId);
if (memoryPtr)
_screen->bitsSave(workerRect, screenMask, memoryPtr);
diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp
index 8a9d9b9657..338b70901e 100644
--- a/engines/sci/graphics/paint32.cpp
+++ b/engines/sci/graphics/paint32.cpp
@@ -37,11 +37,12 @@ reg_t GfxPaint32::kernelAddLine(const reg_t planeObject, const Common::Point &st
}
Common::Rect gameRect;
- BitmapResource bitmap = makeLineBitmap(startPoint, endPoint, priority, color, style, pattern, thickness, gameRect);
+ reg_t bitmapId = makeLineBitmap(startPoint, endPoint, priority, color, style, pattern, thickness, gameRect);
+ SciBitmap &bitmap = *_segMan->lookupBitmap(bitmapId);
CelInfo32 celInfo;
celInfo.type = kCelTypeMem;
- celInfo.bitmap = bitmap.getObject();
+ celInfo.bitmap = bitmapId;
// SSCI stores the line color on `celInfo`, even though
// this is not a `kCelTypeColor`, as a hack so that
// `kUpdateLine` can get the originally used color
@@ -59,10 +60,10 @@ reg_t GfxPaint32::kernelAddLine(const reg_t planeObject, const Common::Point &st
void GfxPaint32::kernelUpdateLine(ScreenItem *screenItem, Plane *plane, const Common::Point &startPoint, const Common::Point &endPoint, const int16 priority, const uint8 color, const LineStyle style, const uint16 pattern, const uint8 thickness) {
Common::Rect gameRect;
- BitmapResource bitmap = makeLineBitmap(startPoint, endPoint, priority, color, style, pattern, thickness, gameRect);
+ reg_t bitmapId = makeLineBitmap(startPoint, endPoint, priority, color, style, pattern, thickness, gameRect);
- _segMan->freeHunkEntry(screenItem->_celInfo.bitmap);
- screenItem->_celInfo.bitmap = bitmap.getObject();
+ _segMan->freeBitmap(screenItem->_celInfo.bitmap);
+ screenItem->_celInfo.bitmap = bitmapId;
screenItem->_celInfo.color = color;
screenItem->_position = startPoint;
screenItem->_priority = priority;
@@ -80,7 +81,7 @@ void GfxPaint32::kernelDeleteLine(const reg_t screenItemObject, const reg_t plan
return;
}
- _segMan->freeHunkEntry(screenItem->_celInfo.bitmap);
+ _segMan->freeBitmap(screenItem->_celInfo.bitmap);
g_sci->_gfxFrameout->deleteScreenItem(*screenItem, *plane);
}
@@ -116,7 +117,7 @@ void GfxPaint32::plotter(int x, int y, int color, void *data) {
}
}
-BitmapResource GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::Point &endPoint, const int16 priority, const uint8 color, const LineStyle style, uint16 pattern, uint8 thickness, Common::Rect &outRect) {
+reg_t GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::Point &endPoint, const int16 priority, const uint8 color, const LineStyle style, uint16 pattern, uint8 thickness, Common::Rect &outRect) {
const uint8 skipColor = color != kDefaultSkipColor ? kDefaultSkipColor : 0;
// Thickness is expected to be 2n+1
@@ -128,7 +129,8 @@ BitmapResource GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const
outRect.right = (startPoint.x > endPoint.x ? startPoint.x : endPoint.x) + halfThickness + 1;
outRect.bottom = (startPoint.y > endPoint.y ? startPoint.y : endPoint.y) + halfThickness + 1;
- BitmapResource bitmap(_segMan, outRect.width(), outRect.height(), skipColor, 0, 0, g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, 0, false, true);
+ reg_t bitmapId;
+ SciBitmap &bitmap = *_segMan->allocateBitmap(&bitmapId, outRect.width(), outRect.height(), skipColor, 0, 0, g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, 0, false, true);
byte *pixels = bitmap.getPixels();
memset(pixels, skipColor, bitmap.getWidth() * bitmap.getHeight());
@@ -174,7 +176,7 @@ BitmapResource GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const
Graphics::drawThickLine2(drawRect.left, drawRect.top, drawRect.right, drawRect.bottom, thickness, color, plotter, &properties);
}
- return bitmap;
+ return bitmapId;
}
diff --git a/engines/sci/graphics/paint32.h b/engines/sci/graphics/paint32.h
index 6d5a957fcd..3c3b7b4343 100644
--- a/engines/sci/graphics/paint32.h
+++ b/engines/sci/graphics/paint32.h
@@ -24,8 +24,8 @@
#define SCI_GRAPHICS_PAINT32_H
namespace Sci {
-class BitmapResource;
class Plane;
+class SciBitmap;
class ScreenItem;
class SegManager;
@@ -54,7 +54,7 @@ public:
private:
typedef struct {
- BitmapResource *bitmap;
+ SciBitmap *bitmap;
bool pattern[16];
uint8 patternIndex;
bool solid;
@@ -64,7 +64,7 @@ private:
static void plotter(int x, int y, int color, void *data);
- BitmapResource makeLineBitmap(const Common::Point &startPoint, const Common::Point &endPoint, const int16 priority, const uint8 color, const LineStyle style, const uint16 pattern, const uint8 thickness, Common::Rect &outRect);
+ reg_t makeLineBitmap(const Common::Point &startPoint, const Common::Point &endPoint, const int16 priority, const uint8 color, const LineStyle style, const uint16 pattern, const uint8 thickness, Common::Rect &outRect);
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index a26c92c364..1514ad838f 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -626,7 +626,7 @@ void GfxPalette::kernelAnimateSet() {
reg_t GfxPalette::kernelSave() {
SegManager *segMan = g_sci->getEngineState()->_segMan;
- reg_t memoryId = segMan->allocateHunkEntry("kPalette(save)", 1024, true);
+ reg_t memoryId = segMan->allocateHunkEntry("kPalette(save)", 1024);
byte *memoryPtr = segMan->getHunkPointer(memoryId);
if (memoryPtr) {
for (int colorNr = 0; colorNr < 256; colorNr++) {
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index d612ddbfa3..f81d50946b 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -96,8 +96,7 @@ reg_t GfxText32::createFontBitmap(int16 width, int16 height, const Common::Rect
_textRect = Common::Rect();
}
- BitmapResource bitmap(_segMan, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false, gc);
- _bitmap = bitmap.getObject();
+ _segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false, gc);
erase(bitmapRect, false);
@@ -135,8 +134,7 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &
_textRect = Common::Rect();
}
- BitmapResource bitmap(_segMan, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false, gc);
- _bitmap = bitmap.getObject();
+ SciBitmap &bitmap = *_segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 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
@@ -180,8 +178,8 @@ void GfxText32::setFont(const GuiResourceId fontId) {
void GfxText32::drawFrame(const Common::Rect &rect, const int16 size, const uint8 color, const bool doScaling) {
Common::Rect targetRect = doScaling ? scaleRect(rect) : rect;
- byte *bitmap = _segMan->getHunkPointer(_bitmap);
- byte *pixels = bitmap + READ_SCI11ENDIAN_UINT32(bitmap + 28) + rect.top * _width + rect.left;
+ SciBitmap &bitmap = *_segMan->lookupBitmap(_bitmap);
+ byte *pixels = bitmap.getPixels() + rect.top * _width + rect.left;
// NOTE: Not fully disassembled, but this should be right
int16 rectWidth = targetRect.width();
@@ -210,8 +208,8 @@ void GfxText32::drawFrame(const Common::Rect &rect, const int16 size, const uint
}
void GfxText32::drawChar(const char charIndex) {
- byte *bitmap = _segMan->getHunkPointer(_bitmap);
- byte *pixels = bitmap + READ_SCI11ENDIAN_UINT32(bitmap + 28);
+ SciBitmap &bitmap = *_segMan->lookupBitmap(_bitmap);
+ byte *pixels = bitmap.getPixels();
_font->drawToBuffer(charIndex, _drawPosition.y, _drawPosition.x, _foreColor, _dimmed, pixels, _width, _height);
_drawPosition.x += _font->getCharWidth(charIndex);
@@ -328,14 +326,14 @@ void GfxText32::drawText(const uint index, uint length) {
}
}
-void GfxText32::invertRect(const reg_t bitmap, int16 bitmapStride, const Common::Rect &rect, const uint8 foreColor, const uint8 backColor, const bool doScaling) {
+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;
targetRect = scaleRect(rect);
}
- byte *bitmapData = _segMan->getHunkPointer(bitmap);
+ SciBitmap &bitmap = *_segMan->lookupBitmap(bitmapId);
// NOTE: SCI code is super weird here; it seems to be trying to look at the
// entire size of the bitmap including the header, instead of just the pixel
@@ -345,14 +343,14 @@ void GfxText32::invertRect(const reg_t bitmap, int16 bitmapStride, const Common:
// function was never updated to match? Or maybe they exploit the
// configurable stride length somewhere else to do stair stepping inverts...
uint32 invertSize = targetRect.height() * bitmapStride + targetRect.width();
- uint32 bitmapSize = READ_SCI11ENDIAN_UINT32(bitmapData + 12);
+ uint32 bitmapSize = bitmap.getDataSize();
if (invertSize >= bitmapSize) {
error("InvertRect too big: %u >= %u", invertSize, bitmapSize);
}
// NOTE: Actual engine just added the bitmap header size hardcoded here
- byte *pixel = bitmapData + READ_SCI11ENDIAN_UINT32(bitmapData + 28) + bitmapStride * targetRect.top + targetRect.left;
+ byte *pixel = bitmap.getPixels() + bitmapStride * targetRect.top + targetRect.left;
int16 stride = bitmapStride - targetRect.width();
int16 targetHeight = targetRect.height();
@@ -615,7 +613,7 @@ Common::Rect GfxText32::getTextSize(const Common::String &text, int16 maxWidth,
void GfxText32::erase(const Common::Rect &rect, const bool doScaling) {
Common::Rect targetRect = doScaling ? scaleRect(rect) : rect;
- BitmapResource bitmap(_bitmap);
+ SciBitmap &bitmap = *_segMan->lookupBitmap(_bitmap);
bitmap.getBuffer().fillRect(targetRect, _backColor);
}
@@ -652,7 +650,7 @@ int16 GfxText32::getTextCount(const Common::String &text, const uint index, cons
}
void GfxText32::scrollLine(const Common::String &lineText, int numLines, uint8 color, TextAlign align, GuiResourceId fontId, ScrollDirection dir) {
- BitmapResource bmr(_bitmap);
+ SciBitmap &bmr = *_segMan->lookupBitmap(_bitmap);
byte *pixels = bmr.getPixels();
int h = _font->getHeight();
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 40921563d0..44bd48afd5 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -42,210 +42,6 @@ enum ScrollDirection {
kScrollDown
};
-enum BitmapFlags {
- kBitmapRemap = 2
-};
-
-enum {
- kDefaultSkipColor = 250
-};
-
-#define BITMAP_PROPERTY(size, property, offset)\
-inline uint##size get##property() const {\
- return READ_SCI11ENDIAN_UINT##size(_bitmap + (offset));\
-}\
-inline void set##property(uint##size value) {\
- WRITE_SCI11ENDIAN_UINT##size(_bitmap + (offset), (value));\
-}
-
-/**
- * A convenience class for creating and modifying in-memory
- * bitmaps.
- */
-class BitmapResource {
- byte *_bitmap;
- reg_t _object;
- Buffer _buffer;
-
- /**
- * Gets the size of the bitmap header for the current
- * engine version.
- */
- static inline uint16 getBitmapHeaderSize() {
- // TODO: These values are accurate for each engine, but there may be no reason
- // to not simply just always use size 40, since SCI2.1mid does not seem to
- // actually store any data above byte 40, and SCI2 did not allow bitmaps with
- // scaling resolutions other than the default (320x200). Perhaps SCI3 used
- // the extra bytes, or there is some reason why they tried to align the header
- // size with other headers like pic headers?
-// uint32 bitmapHeaderSize;
-// if (getSciVersion() >= SCI_VERSION_2_1_MIDDLE) {
-// bitmapHeaderSize = 46;
-// } else if (getSciVersion() == SCI_VERSION_2_1_EARLY) {
-// bitmapHeaderSize = 40;
-// } else {
-// bitmapHeaderSize = 36;
-// }
-// return bitmapHeaderSize;
- return 46;
- }
-
- /**
- * Gets the byte size of a bitmap with the given width
- * and height.
- */
- static inline uint32 getBitmapSize(const uint16 width, const uint16 height) {
- return width * height + getBitmapHeaderSize();
- }
-
-public:
- /**
- * Create a bitmap resource for an existing bitmap.
- * Ownership of the bitmap is retained by the caller.
- */
- inline BitmapResource(reg_t bitmap) :
- _bitmap(g_sci->getEngineState()->_segMan->getHunkPointer(bitmap)),
- _object(bitmap) {
- if (_bitmap == nullptr || getUncompressedDataOffset() != getBitmapHeaderSize()) {
- error("Invalid Text bitmap %04x:%04x", PRINT_REG(bitmap));
- }
-
- _buffer = Buffer(getWidth(), getHeight(), getPixels());
- }
-
- /**
- * Allocates and initialises a new bitmap in the given
- * segment manager.
- */
- inline BitmapResource(SegManager *segMan, const int16 width, const int16 height, const uint8 skipColor, const int16 displaceX, const int16 displaceY, const int16 scaledWidth, const int16 scaledHeight, const uint32 paletteSize, const bool remap, const bool gc) {
- _object = segMan->allocateHunkEntry("Bitmap()", getBitmapSize(width, height) + paletteSize, gc);
- _bitmap = segMan->getHunkPointer(_object);
-
- const uint16 bitmapHeaderSize = getBitmapHeaderSize();
-
- setWidth(width);
- setHeight(height);
- setDisplace(Common::Point(displaceX, displaceY));
- setSkipColor(skipColor);
- _bitmap[9] = 0;
- WRITE_SCI11ENDIAN_UINT16(_bitmap + 10, 0);
- setRemap(remap);
- setDataSize(width * height);
- WRITE_SCI11ENDIAN_UINT32(_bitmap + 16, 0);
- setHunkPaletteOffset(paletteSize > 0 ? (width * height) : 0);
- setDataOffset(bitmapHeaderSize);
- setUncompressedDataOffset(bitmapHeaderSize);
- setControlOffset(0);
- setScaledWidth(scaledWidth);
- setScaledHeight(scaledHeight);
-
- _buffer = Buffer(getWidth(), getHeight(), getPixels());
- }
-
- inline reg_t getObject() const {
- return _object;
- }
-
- inline Buffer &getBuffer() {
- return _buffer;
- }
-
- BITMAP_PROPERTY(16, Width, 0);
- BITMAP_PROPERTY(16, Height, 2);
-
- inline Common::Point getDisplace() const {
- return Common::Point(
- (int16)READ_SCI11ENDIAN_UINT16(_bitmap + 4),
- (int16)READ_SCI11ENDIAN_UINT16(_bitmap + 6)
- );
- }
-
- inline void setDisplace(const Common::Point &displace) {
- WRITE_SCI11ENDIAN_UINT16(_bitmap + 4, (uint16)displace.x);
- WRITE_SCI11ENDIAN_UINT16(_bitmap + 6, (uint16)displace.y);
- }
-
- inline uint8 getSkipColor() const {
- return _bitmap[8];
- }
-
- inline void setSkipColor(const uint8 skipColor) {
- _bitmap[8] = skipColor;
- }
-
- inline bool getRemap() const {
- return READ_SCI11ENDIAN_UINT16(_bitmap + 10) & kBitmapRemap;
- }
-
- inline void setRemap(const bool remap) {
- uint16 flags = READ_SCI11ENDIAN_UINT16(_bitmap + 10);
- if (remap) {
- flags |= kBitmapRemap;
- } else {
- flags &= ~kBitmapRemap;
- }
- WRITE_SCI11ENDIAN_UINT16(_bitmap + 10, flags);
- }
-
- BITMAP_PROPERTY(32, DataSize, 12);
-
- inline uint32 getHunkPaletteOffset() const {
- return READ_SCI11ENDIAN_UINT32(_bitmap + 20);
- }
-
- inline void setHunkPaletteOffset(uint32 hunkPaletteOffset) {
- if (hunkPaletteOffset) {
- hunkPaletteOffset += getBitmapHeaderSize();
- }
-
- WRITE_SCI11ENDIAN_UINT32(_bitmap + 20, hunkPaletteOffset);
- }
-
- BITMAP_PROPERTY(32, DataOffset, 24);
-
- // NOTE: This property is used as a "magic number" for
- // validating that a block of memory is a valid bitmap,
- // and so is always set to the size of the header.
- BITMAP_PROPERTY(32, UncompressedDataOffset, 28);
-
- // NOTE: This property always seems to be zero
- BITMAP_PROPERTY(32, ControlOffset, 32);
-
- inline uint16 getScaledWidth() const {
- if (getDataOffset() >= 40) {
- return READ_SCI11ENDIAN_UINT16(_bitmap + 36);
- }
-
- // SCI2 bitmaps did not have scaling ability
- return 320;
- }
-
- inline void setScaledWidth(uint16 scaledWidth) {
- if (getDataOffset() >= 40) {
- WRITE_SCI11ENDIAN_UINT16(_bitmap + 36, scaledWidth);
- }
- }
-
- inline uint16 getScaledHeight() const {
- if (getDataOffset() >= 40) {
- return READ_SCI11ENDIAN_UINT16(_bitmap + 38);
- }
-
- // SCI2 bitmaps did not have scaling ability
- return 200;
- }
-
- inline void setScaledHeight(uint16 scaledHeight) {
- if (getDataOffset() >= 40) {
- WRITE_SCI11ENDIAN_UINT16(_bitmap + 38, scaledHeight);
- }
- }
-
- inline byte *getPixels() {
- return _bitmap + getUncompressedDataOffset();
- }
-};
-
class GfxFont;
/**
diff --git a/engines/sci/graphics/transitions32.cpp b/engines/sci/graphics/transitions32.cpp
index 01956e6a2f..251e439cf5 100644
--- a/engines/sci/graphics/transitions32.cpp
+++ b/engines/sci/graphics/transitions32.cpp
@@ -362,7 +362,7 @@ ShowStyleList::iterator GfxTransitions32::deleteShowStyle(const ShowStyleList::i
case kShowStyleDissolveNoMorph:
case kShowStyleDissolve:
if (getSciVersion() <= SCI_VERSION_2_1_EARLY) {
- _segMan->freeHunkEntry(showStyle->bitmap);
+ _segMan->freeBitmap(showStyle->bitmap);
g_sci->_gfxFrameout->deleteScreenItem(*showStyle->bitmapScreenItem);
}
break;
@@ -459,9 +459,10 @@ void GfxTransitions32::configure21EarlyIris(PlaneShowStyle &showStyle, const int
void GfxTransitions32::configure21EarlyDissolve(PlaneShowStyle &showStyle, const int16 priority, const Common::Rect &gameRect) {
- BitmapResource bitmap(_segMan, showStyle.width, showStyle.height, kDefaultSkipColor, 0, 0, kLowResX, kLowResY, 0, false, false);
+ reg_t bitmapId;
+ SciBitmap &bitmap = *_segMan->allocateBitmap(&bitmapId, showStyle.width, showStyle.height, kDefaultSkipColor, 0, 0, kLowResX, kLowResY, 0, false, false);
- showStyle.bitmap = bitmap.getObject();
+ showStyle.bitmap = bitmapId;
const Buffer &source = g_sci->_gfxFrameout->getCurrentBuffer();
Buffer target(showStyle.width, showStyle.height, bitmap.getPixels());
@@ -471,7 +472,7 @@ void GfxTransitions32::configure21EarlyDissolve(PlaneShowStyle &showStyle, const
CelInfo32 celInfo;
celInfo.type = kCelTypeMem;
- celInfo.bitmap = bitmap.getObject();
+ celInfo.bitmap = bitmapId;
showStyle.bitmapScreenItem = new ScreenItem(showStyle.plane, celInfo, Common::Point(0, 0), ScaleInfo());
showStyle.bitmapScreenItem->_priority = priority;
@@ -608,7 +609,7 @@ bool GfxTransitions32::processPixelDissolve(PlaneShowStyle &showStyle) {
bool GfxTransitions32::processPixelDissolve21Early(PlaneShowStyle &showStyle) {
bool unchanged = true;
- BitmapResource bitmap(showStyle.bitmap);
+ SciBitmap &bitmap = *_segMan->lookupBitmap(showStyle.bitmap);
Buffer buffer(showStyle.width, showStyle.height, bitmap.getPixels());
uint32 numPixels = showStyle.width * showStyle.height;
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 46607066f6..dc2641c92a 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -117,7 +117,7 @@ VMDPlayer::IOStatus VMDPlayer::close() {
if (!_planeIsOwned && _screenItem != nullptr) {
g_sci->_gfxFrameout->deleteScreenItem(*_screenItem);
- g_sci->getEngineState()->_segMan->freeHunkEntry(_screenItem->_celInfo.bitmap);
+ g_sci->getEngineState()->_segMan->freeBitmap(_screenItem->_celInfo.bitmap);
_screenItem = nullptr;
} else if (_plane != nullptr) {
g_sci->_gfxFrameout->deletePlane(*_plane);
@@ -232,14 +232,15 @@ VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) {
const int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
const int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- BitmapResource vmdBitmap(_segMan, vmdRect.width(), vmdRect.height(), 255, 0, 0, screenWidth, screenHeight, 0, false, false);
+ reg_t bitmapId;
+ SciBitmap &vmdBitmap = *_segMan->allocateBitmap(&bitmapId, vmdRect.width(), vmdRect.height(), 255, 0, 0, screenWidth, screenHeight, 0, false, false);
if (screenWidth != scriptWidth || screenHeight != scriptHeight) {
mulru(vmdRect, Ratio(scriptWidth, screenWidth), Ratio(scriptHeight, screenHeight), 1);
}
CelInfo32 vmdCelInfo;
- vmdCelInfo.bitmap = vmdBitmap.getObject();
+ vmdCelInfo.bitmap = bitmapId;
_decoder->setSurfaceMemory(vmdBitmap.getPixels(), vmdBitmap.getWidth(), vmdBitmap.getHeight(), 1);
if (_planeIsOwned) {