diff options
author | Alejandro Marzini | 2010-07-26 02:16:10 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-26 02:16:10 +0000 |
commit | c5037d7c6c42b6682523f0cde7af69178250fcfa (patch) | |
tree | 1af55f77a6b058ca28ed0dc5f011579ef7d1d447 /backends/graphics/opengl/opengl-graphics.cpp | |
parent | b89412d7e4a8473292a041f0fe6519ccd2d06621 (diff) | |
download | scummvm-rg350-c5037d7c6c42b6682523f0cde7af69178250fcfa.tar.gz scummvm-rg350-c5037d7c6c42b6682523f0cde7af69178250fcfa.tar.bz2 scummvm-rg350-c5037d7c6c42b6682523f0cde7af69178250fcfa.zip |
OPENGL: Fixed alpha problem with overlay RGBA5551 format.
svn-id: r51290
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 6ba4fed474..78d70bff66 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -485,13 +485,26 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch if (w <= 0 || h <= 0) return; - // Copy buffer data to internal overlay surface - const byte *src = (byte *)buf; - byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch; - for (int i = 0; i < h; i++) { - memcpy(dst + x * _overlayData.bytesPerPixel, src, w * _overlayData.bytesPerPixel); - src += pitch * sizeof(buf[0]); - dst += _overlayData.pitch; + if (_overlayFormat.aBits() == 1) { + // Copy buffer with the alpha bit on for all pixels for correct + // overlay drawing. + const uint16 *src = (uint16 *)buf; + uint16 *dst = (uint16 *)_overlayData.pixels + y * _overlayData.w + x; + for (int i = 0; i < h; i++) { + for (int e = 0; e < w; e++) + dst[e] = src[e] | 0x1; + src += pitch; + dst += _overlayData.w; + } + } else { + // Copy buffer data to internal overlay surface + const byte *src = (byte *)buf; + byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch; + for (int i = 0; i < h; i++) { + memcpy(dst + x * _overlayData.bytesPerPixel, src, w * _overlayData.bytesPerPixel); + src += pitch * sizeof(buf[0]); + dst += _overlayData.pitch; + } } if (!_overlayNeedsRedraw) { |