From 9f48a37671737229e76cd38cf766d855fd2e7318 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 28 Jun 2010 11:20:14 +0000 Subject: SCI: Add const qualifiers to many GfxView methods and their return values. This helps to ensure proper data encapsulation. Also reformatted some overlong comments to 80 chars per line, and fixed some other code formatting issues. svn-id: r50421 --- engines/sci/graphics/cursor.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'engines/sci/graphics/cursor.cpp') diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index db42dac3dd..c5f4de9cf5 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -164,12 +164,11 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co GfxView *cursorView = _cachedCursors[viewNum]; - CelInfo *celInfo = cursorView->getCelInfo(loopNum, celNum); + const CelInfo *celInfo = cursorView->getCelInfo(loopNum, celNum); int16 width = celInfo->width; int16 height = celInfo->height; byte clearKey = celInfo->clearKey; Common::Point *cursorHotspot = hotspot; - byte *cursorBitmap; if (!cursorHotspot) // Compute hotspot from xoffset/yoffset @@ -182,24 +181,21 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co return; } - celInfo->rawBitmap = cursorView->getBitmap(loopNum, celNum); + const byte *rawBitmap = cursorView->getBitmap(loopNum, celNum); if (_upscaledHires) { // Scale cursor by 2x - note: sierra didn't do this, but it looks much better width *= 2; height *= 2; cursorHotspot->x *= 2; cursorHotspot->y *= 2; - cursorBitmap = new byte[width * height]; - _screen->scale2x(celInfo->rawBitmap, cursorBitmap, celInfo->width, celInfo->height); + byte *cursorBitmap = new byte[width * height]; + _screen->scale2x(rawBitmap, cursorBitmap, celInfo->width, celInfo->height); + CursorMan.replaceCursor(cursorBitmap, width, height, cursorHotspot->x, cursorHotspot->y, clearKey); + delete[] cursorBitmap; } else { - cursorBitmap = celInfo->rawBitmap; + CursorMan.replaceCursor(rawBitmap, width, height, cursorHotspot->x, cursorHotspot->y, clearKey); } - CursorMan.replaceCursor(cursorBitmap, width, height, cursorHotspot->x, cursorHotspot->y, clearKey); - - if (_upscaledHires) - delete[] cursorBitmap; - kernelShow(); delete cursorHotspot; -- cgit v1.2.3