BACKENDS: Fix GUI RGB cursor on PSP

This commit is contained in:
rsn8887 2020-12-12 12:31:14 -06:00
parent c0175f7749
commit 8b4cb4f745
2 changed files with 11 additions and 4 deletions

View File

@ -272,7 +272,13 @@ void Cursor::setSizeAndScummvmPixelFormat(uint32 width, uint32 height, const Gra
PSP_DEBUG_PRINT("palette pixel format[%u]\n", paletteType);
if (paletteType == PSPPixelFormat::Type_None) {
setRendererModePalettized(false); // use palettized mechanism
setRendererModePalettized(false); // use non-palettized mechanism
if (format) {
if (format->aBits() == 0)
_fakeAlpha = true; // we are treating e.g. 555 as 5551
else
_fakeAlpha = false; // we have a genuine alpha channel
}
} else { // We have a palette
_palette.setPixelFormats(paletteType, bufferType);
setRendererModePalettized(true); // use palettized mechanism
@ -312,9 +318,9 @@ inline void Cursor::setRendererModePalettized(bool palettized) {
_renderer.setAlphaBlending(true);
// Pixel formats without alpha (5650) are considered to have their alpha set.
// Since pixel formats with alpha don't have their alpha bits set, we reverse
// Since pixel formats like 555 are treated as 5551 on PSP, we reverse
// the alpha format for them so that 0 alpha is 1.
if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650)
if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650 && _fakeAlpha)
_renderer.setAlphaReverse(true);
else
_renderer.setAlphaReverse(false);

View File

@ -36,13 +36,14 @@ private:
uint32 _mouseLimitHeight;
int32 _x, _y;
Palette _screenPalette; // separate palette for screen. default 'palette' is cursor palette.
bool _fakeAlpha; // true if treating e.g. 555 as 5551, false if there's a genuine alpha channel
void updateRendererOffset();
public:
Cursor() : _hotspotX(0), _hotspotY(0), _keyColor(0), _cursorTargetScale(0),
_useCursorPalette(false), _hasCursorPalette(false), _mouseLimitWidth(0),
_mouseLimitHeight(0), _x(0), _y(0) { }
_mouseLimitHeight(0), _x(0), _y(0), _fakeAlpha(false) { }
virtual ~Cursor() { deallocate(); }
void setKeyColor(uint32 color);