[Scummvm-cvs-logs] SF.net SVN: scummvm: [23908] scummvm/trunk/backends/platform/PalmOS/Src
chrilith at users.sourceforge.net
chrilith at users.sourceforge.net
Sun Sep 17 11:59:43 CEST 2006
Revision: 23908
http://svn.sourceforge.net/scummvm/?rev=23908&view=rev
Author: chrilith
Date: 2006-09-17 02:59:31 -0700 (Sun, 17 Sep 2006)
Log Message:
-----------
Fixed back mouse in GUI adding cursor palette support
Fixed cursor redraw in GUI
Fixed cursor glitches problem in BS because of too small buffer
Cleanup
Modified Paths:
--------------
scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp
scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp
scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h
scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp
scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp
scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp
Modified: scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp 2006-09-17 09:59:31 UTC (rev 23908)
@@ -39,11 +39,6 @@
bool last = _mouseVisible;
_mouseVisible = visible;
- if (visible)
- draw_mouse();
- else
- undraw_mouse();
-
return last;
}
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp 2006-09-17 09:59:31 UTC (rev 23908)
@@ -57,7 +57,6 @@
_batCheckTicks = SysTicksPerSecond() * 15;
_batCheckLast = TimGetTicks();
- _mouseDataH = NULL;
_mouseDataP = NULL;
_mouseVisible = false;
_mouseDrawn = false;
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.h 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.h 2006-09-17 09:59:31 UTC (rev 23908)
@@ -102,8 +102,8 @@
kKeyAny = 1 << 31
};
enum {
- MAX_MOUSE_W = 40,
- MAX_MOUSE_H = 40
+ MAX_MOUSE_W = 48,
+ MAX_MOUSE_H = 48
};
struct MousePos {
int16 x,y,w,h;
@@ -151,7 +151,7 @@
int16 _mouseHotspotY;
byte _mouseKeyColor;
byte *_mouseDataP, *_mouseBackupP;
- WinHandle _mouseDataH, _mouseBackupH;
+
eventsEnum _lastEvent;
WChar _lastKey;
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp 2006-09-17 09:59:31 UTC (rev 23908)
@@ -37,6 +37,7 @@
_overlayH = NULL;
_isSwitchable = false;
_wasRotated = false;
+ _cursorPaletteDisabled = true;
MemSet(&_soundEx, sizeof(SoundExType), 0);
_soundEx.sound = &_sound;
@@ -61,6 +62,15 @@
}
}
+bool OSystem_PalmOS5::hasFeature(Feature f) {
+ switch (f) {
+ case kFeatureCursorHasPalette:
+ return true;
+ }
+
+ return false;
+}
+
void OSystem_PalmOS5::setWindowCaption(const char *caption) {
Err e;
Char buf[64];
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h 2006-09-17 09:59:31 UTC (rev 23908)
@@ -105,7 +105,7 @@
OverlayColor *_overlayP;
WinHandle _overlayH, _workScreenH;
- int16 _nativePal[256];
+ int16 _nativePal[256], _mousePal[256];
int16 *_workScreenP;
Boolean _isSwitchable, _wasRotated;
@@ -135,16 +135,20 @@
protected:
UInt16 _sysOldCoord, _sysOldOrientation;
- Boolean _stretched;
+ Boolean _stretched, _cursorPaletteDisabled;
public:
OSystem_PalmOS5();
static OSystem *create();
+ bool hasFeature(Feature f);
+
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
void clearScreen();
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale);
+ virtual void setCursorPalette(const byte *colors, uint start, uint num);
+ void disableCursorPalette(bool disable);
void showOverlay();
void hideOverlay();
Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h 2006-09-17 09:59:31 UTC (rev 23908)
@@ -46,7 +46,7 @@
TwGfxType *_gfxH;
TwGfxSurfaceType *_palmScreenP, *_tmpScreenP;
TwGfxSurfaceType *_overlayP;
- UInt16 _nativePal[256];
+ UInt16 _nativePal[256], _mousePal[256];
Boolean _fullscreen;
TwGfxPointType _srcPos;
@@ -75,11 +75,14 @@
static OSystem *create();
void setFeatureState(Feature f, bool enable);
+
int getDefaultGraphicsMode() const;
void updateScreen();
bool grabRawScreen(Graphics::Surface *surf);
+ void setCursorPalette(const byte *colors, uint start, uint num);
+
void clearOverlay();
void grabOverlay(OverlayColor *buf, int pitch);
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp 2006-09-17 09:59:31 UTC (rev 23908)
@@ -56,7 +56,9 @@
if (_keyMouse.hasMore) {
switch (ev->data.keyDown.chr) {
// hot swap gfx
+ case 0x1B04:
case vchrHard1:
+ printf("swap\n");
if (OPTIONS_TST(kOptCollapsible))
hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE);
return false; // not a key
Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp 2006-09-17 09:59:31 UTC (rev 23908)
@@ -24,6 +24,19 @@
#include "be_os5.h"
+void OSystem_PalmOS5::setCursorPalette(const byte *colors, uint start, uint num) {
+ for(uint i = 0; i < num; i++) {
+ _mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]);
+ colors += 4;
+ }
+
+ _cursorPaletteDisabled = false;
+}
+
+void OSystem_PalmOS5::disableCursorPalette(bool disable) {
+ _cursorPaletteDisabled = disable;
+}
+
void OSystem_PalmOS5::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) {
if (w == 0 || h == 0)
return;
@@ -38,6 +51,7 @@
// copy new cursor
byte *dst = _mouseDataP;
+ memset(dst, MAX_MOUSE_W * MAX_MOUSE_H, keycolor);
while (h--) {
memcpy(dst, buf, w);
dst += MAX_MOUSE_W;
@@ -105,14 +119,15 @@
if (_overlayVisible) {
int16 *bak = (int16 *)_mouseBackupP; // Surface used to backup the area obscured by the mouse
int16 *dst = _overlayP + y * _screenWidth + x;
-
+ int16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal;
+
do {
width = w;
do {
*bak++ = *dst;
color = *src++;
if (color != _mouseKeyColor) // transparent, don't draw
- *dst = _nativePal[color];
+ *dst = pal[color];
dst++;
} while (--width);
Modified: scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp 2006-09-17 09:57:07 UTC (rev 23907)
+++ scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp 2006-09-17 09:59:31 UTC (rev 23908)
@@ -24,6 +24,14 @@
#include "be_zodiac.h"
+void OSystem_PalmZodiac::setCursorPalette(const byte *colors, uint start, uint num) {
+ for(uint i = 0; i < num; i++) {
+ _mousePal[i + start] = TwGfxMakeDisplayRGB(colors[0], colors[1], colors[2]);
+ colors += 4;
+ }
+ _cursorPaletteDisabled = false;
+}
+
void OSystem_PalmZodiac::draw_mouse() {
if (_mouseDrawn || !_mouseVisible)
return;
@@ -72,18 +80,18 @@
// Backup the covered area draw the mouse cursor
if (_overlayVisible) {
uint16 *bak = (uint16 *)_mouseBackupP; // Surface used to backup the area obscured by the mouse
- uint16 *dst;
+ uint16 *dst, *pal = _cursorPaletteDisabled ? _nativePal : _mousePal;
TwGfxLockSurface(_overlayP, (void **)&dst);
dst += y * _screenWidth + x;
-
+
do {
width = w;
do {
*bak++ = *dst;
color = *src++;
if (color != _mouseKeyColor) // transparent, don't draw
- *dst = _nativePal[color];
+ *dst = pal[color];
dst++;
} while (--width);
@@ -126,7 +134,7 @@
if (_overlayVisible) {
uint16 *bak = (uint16 *)_mouseBackupP;
uint16 *dst;
-
+
TwGfxLockSurface(_overlayP, (void **)&dst);
dst += _mouseOldState.y * _screenWidth + _mouseOldState.x;
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