aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tsage/graphics.cpp')
-rw-r--r--engines/tsage/graphics.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index ce19502524..1815c3d751 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -47,7 +47,7 @@ GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds) {
Graphics::Surface destSurface = dest->lockSurface();
byte *srcP = (byte *)srcSurface.getBasePtr(bounds.left, bounds.top);
- byte *destP = (byte *)destSurface.getBasePtr(0, 0);
+ byte *destP = (byte *)destSurface.getPixels();
for (int y = bounds.top; y < bounds.bottom; ++y, srcP += srcSurface.pitch, destP += destSurface.pitch)
Common::copy(srcP, srcP + destSurface.pitch, destP);
@@ -76,7 +76,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
const byte *srcP = imgData + 10;
Graphics::Surface destSurface = s.lockSurface();
- byte *destP = (byte *)destSurface.getBasePtr(0, 0);
+ byte *destP = (byte *)destSurface.getPixels();
if (!rleEncoded) {
Common::copy(srcP, srcP + (r.width() * r.height()), destP);
@@ -316,7 +316,7 @@ void GfxSurface::create(int width, int height) {
}
_customSurface = new Graphics::Surface();
_customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- Common::fill((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0);
+ Common::fill((byte *)_customSurface->getPixels(), (byte *)_customSurface->getBasePtr(0, height), 0);
_bounds = Rect(0, 0, width, height);
}
@@ -332,12 +332,7 @@ Graphics::Surface GfxSurface::lockSurface() {
// Setup the returned surface either as one pointing to the same pixels as the source, or
// as a subset of the source one based on the currently set bounds
Graphics::Surface result;
- result.w = _bounds.width();
- result.h = _bounds.height();
- result.pitch = src->pitch;
- result.format = src->format;
- result.pixels = src->getBasePtr(_bounds.left, _bounds.top);
-
+ result.init(_bounds.width(), _bounds.height(), src->pitch, src->getBasePtr(_bounds.left, _bounds.top), src->format);
return result;
}
@@ -363,7 +358,7 @@ void GfxSurface::synchronize(Serializer &s) {
if (_customSurface) {
s.syncAsSint16LE(_customSurface->w);
s.syncAsSint16LE(_customSurface->h);
- s.syncBytes((byte *)_customSurface->pixels, _customSurface->w * _customSurface->h);
+ s.syncBytes((byte *)_customSurface->getPixels(), _customSurface->w * _customSurface->h);
} else {
int zero = 0;
s.syncAsSint16LE(zero);
@@ -380,7 +375,7 @@ void GfxSurface::synchronize(Serializer &s) {
_customSurface = NULL;
} else {
create(w, h);
- s.syncBytes((byte *)_customSurface->pixels, w * h);
+ s.syncBytes((byte *)_customSurface->getPixels(), w * h);
}
}
}
@@ -417,8 +412,8 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) {
// Surface owns the internal data, so replicate it so new surface owns it's own
_customSurface = new Graphics::Surface();
_customSurface->create(s._customSurface->w, s._customSurface->h, Graphics::PixelFormat::createFormatCLUT8());
- const byte *srcP = (const byte *)s._customSurface->getBasePtr(0, 0);
- byte *destP = (byte *)_customSurface->getBasePtr(0, 0);
+ const byte *srcP = (const byte *)s._customSurface->getPixels();
+ byte *destP = (byte *)_customSurface->getPixels();
Common::copy(srcP, srcP + (_bounds.width() * _bounds.height()), destP);
}
@@ -581,7 +576,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
Graphics::Surface destSurface = srcImage.lockSurface();
const byte *srcP = (const byte *)srcSurface.getBasePtr(srcBounds.left, srcBounds.top);
- byte *destP = (byte *)destSurface.pixels;
+ byte *destP = (byte *)destSurface.getPixels();
for (int yp = srcBounds.top; yp < srcBounds.bottom; ++yp, srcP += srcSurface.pitch, destP += destSurface.pitch) {
Common::copy(srcP, srcP + srcBounds.width(), destP);
}