aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2011-04-10 09:20:00 +1000
committerPaul Gilbert2011-04-10 09:20:00 +1000
commit9842dd9268951ab1631f1e2d098c5b4b0dc50d71 (patch)
tree81b6637378136ff83e446fd1b177222f06cd1a4a
parent2ed8a255e53b54bfbf2e58ac02f0cfb6b3703b2c (diff)
downloadscummvm-rg350-9842dd9268951ab1631f1e2d098c5b4b0dc50d71.tar.gz
scummvm-rg350-9842dd9268951ab1631f1e2d098c5b4b0dc50d71.tar.bz2
scummvm-rg350-9842dd9268951ab1631f1e2d098c5b4b0dc50d71.zip
TSAGE: Simplified the custom surface code in GfxSurface
-rw-r--r--engines/tsage/graphics.cpp33
-rw-r--r--engines/tsage/graphics.h2
2 files changed, 3 insertions, 32 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 2b323da07a..af28752dfd 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -226,30 +226,14 @@ GfxSurface::GfxSurface(): _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) {
_lockSurfaceCtr = 0;
_customSurface = NULL;
_screenSurfaceP = NULL;
- _freeSurface = false;
}
GfxSurface::GfxSurface(const GfxSurface &s) {
- assert(!s._lockSurfaceCtr);
- _disableUpdates = false;
- _lockSurfaceCtr = 0;
- _screenSurface = s._screenSurface;
- _screenSurfaceP = s._screenSurfaceP;
- _customSurface = s._customSurface;
- _centroid = s._centroid;
- _transColour = s._transColour;
- _bounds = s._bounds;
-
- if (!_screenSurface) {
- create(s._customSurface->w, s._customSurface->h);
- Common::copy((const byte *)s._customSurface->pixels,
- (const byte *)s._customSurface->pixels + (_bounds.width() * _bounds.height()),
- (byte *)_customSurface->pixels);
- }
+ this->operator =(s);
}
GfxSurface::~GfxSurface() {
- if (_freeSurface) {
+ if (_customSurface) {
_customSurface->free();
delete _customSurface;
}
@@ -265,15 +249,6 @@ void GfxSurface::setScreenSurface() {
}
/**
- * Specifies the underlying ScummmVM surface that this class should encapsulate
- */
-void GfxSurface::setSurface(Graphics::Surface *s) {
- _customSurface = s;
- _screenSurface = false;
- _lockSurfaceCtr = 0;
-}
-
-/**
* Specifies that the surface should maintain it's own internal surface
*/
void GfxSurface::create(int width, int height) {
@@ -281,7 +256,6 @@ void GfxSurface::create(int width, int height) {
_screenSurface = false;
_customSurface = new Graphics::Surface();
_customSurface->create(width, height, 1);
- _freeSurface = true;
_bounds = Rect(0, 0, width, height);
}
@@ -342,13 +316,12 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) {
_customSurface = s._customSurface;
_screenSurface = s._screenSurface;
- _freeSurface = s._freeSurface;
_disableUpdates = s._disableUpdates;
_bounds = s._bounds;
_centroid = s._centroid;
_transColour = s._transColour;
- if (_freeSurface) {
+ if (_customSurface) {
// Surface owns the internal data, so replicate it so new surface owns it's own
_customSurface = new Graphics::Surface();
_customSurface->create(_bounds.width(), _bounds.height(), 1);
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index 678fdd7ccd..e1527bdbcb 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -80,7 +80,6 @@ private:
Graphics::Surface *_screenSurfaceP;
int _lockSurfaceCtr;
bool _screenSurface;
- bool _freeSurface;
bool _disableUpdates;
Rect _bounds;
@@ -93,7 +92,6 @@ public:
~GfxSurface();
void setScreenSurface();
- void setSurface(Graphics::Surface *s);
Graphics::Surface lockSurface();
void unlockSurface();
void create(int width, int height);