aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhewg2011-02-14 20:25:17 +0100
committerdhewg2011-02-14 20:26:35 +0100
commitad94ac343a7159578c3091f27e2acfc7149bd583 (patch)
tree251a2214cef37ed650e32219a6c0f68bef92ec0b
parent2e9bf212e889de78c66d9c4e3564327727389e6e (diff)
downloadscummvm-rg350-ad94ac343a7159578c3091f27e2acfc7149bd583.tar.gz
scummvm-rg350-ad94ac343a7159578c3091f27e2acfc7149bd583.tar.bz2
scummvm-rg350-ad94ac343a7159578c3091f27e2acfc7149bd583.zip
ANDROID: Adapt to [set|grab]Palette RGBA->RGB change.
-rw-r--r--backends/platform/android/android.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index efcee488a5..fe52936ad9 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -679,26 +679,12 @@ void OSystem_Android::setPalette(const byte* colors, uint start, uint num) {
if (!_use_mouse_palette)
_setCursorPalette(colors, start, num);
- byte* palette = _game_texture->palette() + start*3;
- do {
- for (int i = 0; i < 3; ++i)
- palette[i] = colors[i];
- palette += 3;
- colors += 4;
- } while (--num);
+ memcpy(_game_texture->palette() + start * 3, colors, num * 3);
}
void OSystem_Android::grabPalette(byte *colors, uint start, uint num) {
ENTER("grabPalette(%p, %u, %u)", colors, start, num);
- const byte* palette = _game_texture->palette_const() + start*3;
- do {
- for (int i = 0; i < 3; ++i)
- colors[i] = palette[i];
- colors[3] = 0xff; // alpha
-
- palette += 3;
- colors += 4;
- } while (--num);
+ memcpy(colors, _game_texture->palette() + start * 3, num * 3);
}
void OSystem_Android::copyRectToScreen(const byte *buf, int pitch,
@@ -934,13 +920,16 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
// Update palette alpha based on keycolor
byte* palette = _mouse_texture->palette();
- int i = 256;
+
+ uint i = 256;
do {
palette[3] = 0xff;
palette += 4;
} while (--i);
+
palette = _mouse_texture->palette();
- palette[keycolor*4 + 3] = 0x00;
+ palette[keycolor * 4 + 3] = 0;
+
_mouse_texture->updateBuffer(0, 0, w, h, buf, w);
_mouse_hotspot = Common::Point(hotspotX, hotspotY);
@@ -949,14 +938,15 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
void OSystem_Android::_setCursorPalette(const byte *colors,
uint start, uint num) {
- byte* palette = _mouse_texture->palette() + start*4;
+ byte* palette = _mouse_texture->palette() + start * 4;
+
do {
for (int i = 0; i < 3; ++i)
palette[i] = colors[i];
// Leave alpha untouched to preserve keycolor
palette += 4;
- colors += 4;
+ colors += 3;
} while (--num);
}