diff options
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/android/android.cpp | 30 | ||||
-rw-r--r-- | backends/platform/wii/osystem_gfx.cpp | 18 |
2 files changed, 14 insertions, 34 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); } diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 4a925a60c9..8dc18464a8 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -326,19 +326,13 @@ void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) { const byte *s = colors; u16 *d = _texGame.palette; - for (uint i = 0; i < num; ++i) { + for (uint i = 0; i < num; ++i, s +=3) d[start + i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(s[0], s[1], s[2]); - s += 4; - } gfx_tex_flush_palette(&_texGame); - s = colors; - d = _cursorPalette; - - for (uint i = 0; i < num; ++i) { + for (uint i = 0; i < num; ++i, s += 3) { d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]); - s += 4; } if (_cursorPaletteDisabled) { @@ -360,13 +354,11 @@ void OSystem_Wii::grabPalette(byte *colors, uint start, uint num) { byte *d = colors; u8 r, g, b; - for (uint i = 0; i < num; ++i) { + for (uint i = 0; i < num; ++i, d += 3) { Graphics::colorToRGB<Graphics::ColorMasks<565> >(s[start + i], r, g, b); d[0] = r; d[1] = g; d[2] = b; - d[3] = 0xff; - d += 4; } } @@ -391,10 +383,8 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) { const byte *s = colors; u16 *d = _texMouse.palette; - for (uint i = 0; i < num; ++i) { + for (uint i = 0; i < num; ++i, s += 3) d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]); - s += 4; - } _cursorPaletteDirty = true; } |