aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/nut_renderer.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-02 22:23:00 +0200
committerJohannes Schickel2013-08-03 02:52:31 +0200
commitc05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038 (patch)
tree1a2b4f8a216de2f2f742a9c9ef68b46c51603883 /engines/scumm/nut_renderer.cpp
parent4790a4abd5c157254cab069bc34aa8ef8347f668 (diff)
downloadscummvm-rg350-c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038.tar.gz
scummvm-rg350-c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038.tar.bz2
scummvm-rg350-c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038.zip
SCUMM: Prefer getBasePtr over direct Surface::pixels access.
Diffstat (limited to 'engines/scumm/nut_renderer.cpp')
-rw-r--r--engines/scumm/nut_renderer.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/scumm/nut_renderer.cpp b/engines/scumm/nut_renderer.cpp
index 048b29d68b..d9f0b412e1 100644
--- a/engines/scumm/nut_renderer.cpp
+++ b/engines/scumm/nut_renderer.cpp
@@ -357,7 +357,10 @@ void NutRenderer::drawFrame(byte *dst, int c, int x, int y) {
}
void NutRenderer::drawChar(const Graphics::Surface &s, byte c, int x, int y, byte color) {
- byte *dst = (byte *)s.pixels + y * s.pitch + x;
+ // FIXME: This gets passed a const destination Surface. Intuitively this
+ // should never get written to. But sadly it does... For now we simply
+ // cast the const qualifier away.
+ byte *dst = (byte *)const_cast<void *>(s.getBasePtr(x, y));
const int width = MIN((int)_chars[c].width, s.w - x);
const int height = MIN((int)_chars[c].height, s.h - y);
const byte *src = unpackChar(c);
@@ -391,7 +394,10 @@ void NutRenderer::drawChar(const Graphics::Surface &s, byte c, int x, int y, byt
}
void NutRenderer::draw2byte(const Graphics::Surface &s, int c, int x, int y, byte color) {
- byte *dst = (byte *)s.pixels + y * s.pitch + x;
+ // FIXME: This gets passed a const destination Surface. Intuitively this
+ // should never get written to. But sadly it does... For now we simply
+ // cast the const qualifier away.
+ byte *dst = (byte *)const_cast<void *>(s.getBasePtr(x, y));
const int width = _vm->_2byteWidth;
const int height = MIN(_vm->_2byteHeight, s.h - y);
const byte *src = _vm->get2byteCharPtr(c);