From c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 22:23:00 +0200 Subject: SCUMM: Prefer getBasePtr over direct Surface::pixels access. --- engines/scumm/nut_renderer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/scumm/nut_renderer.cpp') 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(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(s.getBasePtr(x, y)); const int width = _vm->_2byteWidth; const int height = MIN(_vm->_2byteHeight, s.h - y); const byte *src = _vm->get2byteCharPtr(c); -- cgit v1.2.3