aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-03 00:58:47 +0200
committerJohannes Schickel2013-08-03 02:52:34 +0200
commit509f96dff3e41fe88e78997f8e1617b0067f85cd (patch)
tree0408ea8eb3743507af8d987e49954eaa6ffc68e2 /engines/teenagent
parentaffb7c3cb3d7a898419fc7ea081824382b2d2d8c (diff)
downloadscummvm-rg350-509f96dff3e41fe88e78997f8e1617b0067f85cd.tar.gz
scummvm-rg350-509f96dff3e41fe88e78997f8e1617b0067f85cd.tar.bz2
scummvm-rg350-509f96dff3e41fe88e78997f8e1617b0067f85cd.zip
TEENAGENT: Prefer getBasePtr over direct Surface::pixels access.
Diffstat (limited to 'engines/teenagent')
-rw-r--r--engines/teenagent/font.cpp2
-rw-r--r--engines/teenagent/resources.cpp2
-rw-r--r--engines/teenagent/scene.cpp12
-rw-r--r--engines/teenagent/teenagent.cpp2
4 files changed, 8 insertions, 10 deletions
diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp
index 47f52ff90f..efc107f6db 100644
--- a/engines/teenagent/font.cpp
+++ b/engines/teenagent/font.cpp
@@ -65,7 +65,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color)
byte *glyph = _data + READ_LE_UINT16(_data + idx * 2);
int h = glyph[0], w = glyph[1];
- if (surface == NULL || surface->pixels == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth)
+ if (surface == NULL || surface->getBasePtr(0, 0) == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth)
return w - _widthPack;
int i0 = 0, j0 = 0;
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 399baf469f..cf1c4efdf6 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -160,7 +160,7 @@ void Resources::loadOff(Graphics::Surface &surface, byte *palette, int id) {
off.read(id, buf, bufferSize);
byte *src = buf;
- byte *dst = (byte *)surface.pixels;
+ byte *dst = (byte *)surface.getBasePtr(0, 0);
memcpy(dst, src, 64000);
memcpy(palette, buf + 64000, 768);
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index bdeb11a841..f9a3cca683 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -48,7 +48,6 @@ Scene::Scene(TeenAgentEngine *vm) : _vm(vm), intro(false), _id(0), ons(0),
onEnabled = true;
memset(palette, 0, sizeof(palette));
- background.pixels = 0;
FilePack varia;
varia.open("varia.res");
@@ -74,8 +73,7 @@ Scene::Scene(TeenAgentEngine *vm) : _vm(vm), intro(false), _id(0), ons(0),
}
Scene::~Scene() {
- if (background.pixels)
- background.free();
+ background.free();
delete[] ons;
ons = 0;
@@ -372,7 +370,7 @@ void Scene::init(int id, const Common::Point &pos) {
for (byte i = 0; i < 4; ++i)
customAnimation[i].free();
- if (background.pixels == NULL)
+ if (background.getBasePtr(0, 0) == NULL)
background.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
warp(pos);
@@ -416,7 +414,7 @@ void Scene::init(int id, const Common::Point &pos) {
if (nowPlaying != _vm->res->dseg.get_byte(dsAddr_currentMusic))
_vm->music->load(_vm->res->dseg.get_byte(dsAddr_currentMusic));
- _vm->_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
+ _vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h);
setPalette(0);
}
@@ -642,8 +640,8 @@ bool Scene::render(bool tickGame, bool tickMark, uint32 messageDelta) {
return true;
}
- if (background.pixels && debugFeatures.feature[DebugFeatures::kShowBack]) {
- _vm->_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
+ if (background.getBasePtr(0, 0) && debugFeatures.feature[DebugFeatures::kShowBack]) {
+ _vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h);
} else
_vm->_system->fillScreen(0);
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 0b48a18b26..40c868042e 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -399,7 +399,7 @@ bool TeenAgentEngine::showLogo() {
return true;
}
- _system->copyRectToScreen(s.pixels, s.w, s.x, s.y, s.w, s.h);
+ _system->copyRectToScreen(s.getBasePtr(0, 0), s.w, s.x, s.y, s.w, s.h);
_system->updateScreen();
_system->delayMillis(100);