mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 05:32:45 +00:00
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 svn-id: r23908
This commit is contained in:
parent
5fa194e62b
commit
bc8a755c67
@ -39,11 +39,6 @@ bool OSystem_PalmBase::showMouse(bool visible) {
|
||||
bool last = _mouseVisible;
|
||||
_mouseVisible = visible;
|
||||
|
||||
if (visible)
|
||||
draw_mouse();
|
||||
else
|
||||
undraw_mouse();
|
||||
|
||||
return last;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,6 @@ OSystem_PalmBase::OSystem_PalmBase() {
|
||||
_batCheckTicks = SysTicksPerSecond() * 15;
|
||||
_batCheckLast = TimGetTicks();
|
||||
|
||||
_mouseDataH = NULL;
|
||||
_mouseDataP = NULL;
|
||||
_mouseVisible = false;
|
||||
_mouseDrawn = false;
|
||||
|
@ -102,8 +102,8 @@ protected:
|
||||
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 @@ protected:
|
||||
int16 _mouseHotspotY;
|
||||
byte _mouseKeyColor;
|
||||
byte *_mouseDataP, *_mouseBackupP;
|
||||
WinHandle _mouseDataH, _mouseBackupH;
|
||||
|
||||
|
||||
eventsEnum _lastEvent;
|
||||
WChar _lastKey;
|
||||
|
@ -37,6 +37,7 @@ OSystem_PalmOS5::OSystem_PalmOS5() : OSystem_PalmBase() {
|
||||
_overlayH = NULL;
|
||||
_isSwitchable = false;
|
||||
_wasRotated = false;
|
||||
_cursorPaletteDisabled = true;
|
||||
|
||||
MemSet(&_soundEx, sizeof(SoundExType), 0);
|
||||
_soundEx.sound = &_sound;
|
||||
@ -61,6 +62,15 @@ void OSystem_PalmOS5::int_initBackend() {
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
|
||||
OverlayColor *_overlayP;
|
||||
WinHandle _overlayH, _workScreenH;
|
||||
int16 _nativePal[256];
|
||||
int16 _nativePal[256], _mousePal[256];
|
||||
int16 *_workScreenP;
|
||||
|
||||
Boolean _isSwitchable, _wasRotated;
|
||||
@ -135,16 +135,20 @@ private:
|
||||
|
||||
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();
|
||||
|
@ -46,7 +46,7 @@ private:
|
||||
TwGfxType *_gfxH;
|
||||
TwGfxSurfaceType *_palmScreenP, *_tmpScreenP;
|
||||
TwGfxSurfaceType *_overlayP;
|
||||
UInt16 _nativePal[256];
|
||||
UInt16 _nativePal[256], _mousePal[256];
|
||||
Boolean _fullscreen;
|
||||
|
||||
TwGfxPointType _srcPos;
|
||||
@ -75,11 +75,14 @@ public:
|
||||
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);
|
||||
|
@ -56,7 +56,9 @@ bool OSystem_PalmOS5::check_event(Event &event, EventPtr ev) {
|
||||
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
|
||||
|
@ -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 @@ void OSystem_PalmOS5::setMouseCursor(const byte *buf, uint w, uint h, int hotspo
|
||||
|
||||
// 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 @@ void OSystem_PalmOS5::draw_mouse() {
|
||||
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);
|
||||
|
||||
|
@ -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 @@ void OSystem_PalmZodiac::draw_mouse() {
|
||||
// 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 @@ void OSystem_PalmZodiac::undraw_mouse() {
|
||||
if (_overlayVisible) {
|
||||
uint16 *bak = (uint16 *)_mouseBackupP;
|
||||
uint16 *dst;
|
||||
|
||||
|
||||
TwGfxLockSurface(_overlayP, (void **)&dst);
|
||||
dst += _mouseOldState.y * _screenWidth + _mouseOldState.x;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user