[Scummvm-git-logs] scummvm master -> 8b4cb4f745a6598a15202087bc0d113f92625987
rsn8887
rsn8887 at users.noreply.github.com
Sat Dec 12 18:32:39 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8b4cb4f745 BACKENDS: Fix GUI RGB cursor on PSP
Commit: 8b4cb4f745a6598a15202087bc0d113f92625987
https://github.com/scummvm/scummvm/commit/8b4cb4f745a6598a15202087bc0d113f92625987
Author: rsn8887 (rsn8887 at users.noreply.github.com)
Date: 2020-12-12T12:31:14-06:00
Commit Message:
BACKENDS: Fix GUI RGB cursor on PSP
Changed paths:
backends/platform/psp/cursor.cpp
backends/platform/psp/cursor.h
diff --git a/backends/platform/psp/cursor.cpp b/backends/platform/psp/cursor.cpp
index 06c5e4904a..3126839fa1 100644
--- a/backends/platform/psp/cursor.cpp
+++ b/backends/platform/psp/cursor.cpp
@@ -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);
diff --git a/backends/platform/psp/cursor.h b/backends/platform/psp/cursor.h
index 85a6cbcc34..61bdfa1b4f 100644
--- a/backends/platform/psp/cursor.h
+++ b/backends/platform/psp/cursor.h
@@ -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);
More information about the Scummvm-git-logs
mailing list