[Scummvm-cvs-logs] SF.net SVN: scummvm:[53010] scummvm/trunk/engines/sci/graphics
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon Oct 4 08:05:34 CEST 2010
Revision: 53010
http://scummvm.svn.sourceforge.net/scummvm/?rev=53010&view=rev
Author: thebluegr
Date: 2010-10-04 06:05:34 +0000 (Mon, 04 Oct 2010)
Log Message:
-----------
SCI: Several corrections for magnifier cursors
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/cursor.cpp
scummvm/trunk/engines/sci/graphics/cursor.h
Modified: scummvm/trunk/engines/sci/graphics/cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-10-03 23:56:49 UTC (rev 53009)
+++ scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-10-04 06:05:34 UTC (rev 53010)
@@ -56,7 +56,6 @@
_zoomCursorLoop = 0;
_zoomCursorCel = 0;
_zoomPicView = 0;
- _zoomBitmap = 0;
_zoomColor = 0;
_zoomMultiplier = 0;
}
@@ -369,34 +368,24 @@
// Cursor
const CelInfo *cursorCelInfo = _zoomCursorView->getCelInfo(_zoomCursorLoop, _zoomCursorCel);
const byte *cursorBitmap = _zoomCursorView->getBitmap(_zoomCursorLoop, _zoomCursorCel);
- int16 cursorWidth = cursorCelInfo->width * (_upscaledHires ? 2 : 1);
- int16 cursorHeight = cursorCelInfo->height * (_upscaledHires ? 2 : 1);
- byte *finalBitmap = new byte[cursorWidth * cursorHeight];
+ byte *finalBitmap = new byte[cursorCelInfo->width * cursorCelInfo->height];
// Pic
const CelInfo *picCelInfo = _zoomPicView->getCelInfo(0, 0);
- int16 picWidth = picCelInfo->width * _zoomMultiplier;
- //int16 picHeight = picCelInfo->height * _zoomMultiplier;
+ const byte *rawPicBitmap = _zoomPicView->getBitmap(0, 0);
// Compute hotspot from xoffset/yoffset
Common::Point cursorHotspot = Common::Point((cursorCelInfo->width >> 1) - cursorCelInfo->displaceX, cursorCelInfo->height - cursorCelInfo->displaceY - 1);
- if (!_upscaledHires) {
- memcpy(finalBitmap, cursorBitmap, cursorCelInfo->width * cursorCelInfo->height);
- } else {
- // Scale cursor by 2x - note: sierra didn't do this, but it looks much better
- cursorHotspot.x *= 2;
- cursorHotspot.y *= 2;
- _screen->scale2x(cursorBitmap, finalBitmap, cursorCelInfo->width, cursorCelInfo->height);
- }
+ memcpy(finalBitmap, cursorBitmap, cursorCelInfo->width * cursorCelInfo->height);
- uint16 targetX = mousePoint.x * _zoomMultiplier - _zoomZone.left;
- uint16 targetY = mousePoint.y * _zoomMultiplier - _zoomZone.top;
+ uint16 targetX = CLIP<int>((mousePoint.x - _zoomZone.left) * _zoomMultiplier, 0, picCelInfo->width - cursorCelInfo->width);
+ uint16 targetY = CLIP<int>((mousePoint.y - _zoomZone.top) * _zoomMultiplier, 0, picCelInfo->height - cursorCelInfo->height);
// Replace the special magnifier color with the associated magnified pixels
for (int x = 0; x < cursorCelInfo->width; x++) {
for (int y = 0; y < cursorCelInfo->height; y++) {
int curPos = cursorCelInfo->width * y + x;
if (finalBitmap[curPos] == _zoomColor) {
- finalBitmap[curPos] = _zoomBitmap[picWidth * (targetY + y) + (targetX + x)];
+ finalBitmap[curPos] = rawPicBitmap[picCelInfo->width * (targetY + y) + (targetX + x)];
}
}
}
@@ -417,7 +406,6 @@
}
void GfxCursor::kernelClearZoomZone() {
- delete[] _zoomBitmap;
kernelResetMoveZone();
_zoomZone = Common::Rect();
_zoomColor = 0;
@@ -448,16 +436,6 @@
kernelSetView(viewNum, loopNum, celNum, NULL);
- GfxView *zoomPicView = _cachedCursors[picNum];
- const byte *rawPicBitmap = zoomPicView->getBitmap(0, 0);
- const CelInfo *celInfo = zoomPicView->getCelInfo(0, 0);
- _zoomBitmap = new byte[(celInfo->width * _zoomMultiplier) * (celInfo->height * _zoomMultiplier)];
-
- if (_zoomMultiplier == 1)
- memcpy(_zoomBitmap, rawPicBitmap, celInfo->width * celInfo->height);
- else if (_zoomMultiplier == 2)
- _screen->scale2x(rawPicBitmap, _zoomBitmap, celInfo->width, celInfo->height);
-
_zoomZone = zone;
kernelSetMoveZone(_zoomZone);
Modified: scummvm/trunk/engines/sci/graphics/cursor.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.h 2010-10-03 23:56:49 UTC (rev 53009)
+++ scummvm/trunk/engines/sci/graphics/cursor.h 2010-10-04 06:05:34 UTC (rev 53010)
@@ -105,7 +105,6 @@
byte _zoomCursorLoop;
byte _zoomCursorCel;
GfxView *_zoomPicView;
- byte *_zoomBitmap;
byte _zoomColor;
byte _zoomMultiplier;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list