diff options
author | Johannes Schickel | 2014-02-11 12:19:30 +0100 |
---|---|---|
committer | Johannes Schickel | 2014-02-11 12:19:30 +0100 |
commit | abcadb5d8728fdc18bf544d8b40418880fa1a145 (patch) | |
tree | 926caae8f64b73a01dc7880c76816c1e7e9ad303 /backends | |
parent | 16898486fa28cb428183d94552f2c9884a718c9f (diff) | |
download | scummvm-rg350-abcadb5d8728fdc18bf544d8b40418880fa1a145.tar.gz scummvm-rg350-abcadb5d8728fdc18bf544d8b40418880fa1a145.tar.bz2 scummvm-rg350-abcadb5d8728fdc18bf544d8b40418880fa1a145.zip |
OPENGL: Fix cursor regression when defaultFormat doesn't have an alpha channel.
Diffstat (limited to 'backends')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 9 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 7 |
2 files changed, 10 insertions, 6 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 3321689366..925b2c5a82 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -572,7 +572,7 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int } else { textureFormat = _defaultFormatAlpha; } - _cursor = createTexture(textureFormat); + _cursor = createTexture(textureFormat, true); assert(_cursor); _cursor->enableLinearFiltering(_currentState.graphicsMode == GFX_LINEAR); } @@ -911,14 +911,15 @@ void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) { } } -Texture *OpenGLGraphicsManager::createTexture(const Graphics::PixelFormat &format) { +Texture *OpenGLGraphicsManager::createTexture(const Graphics::PixelFormat &format, bool wantAlpha) { GLenum glIntFormat, glFormat, glType; if (format.bytesPerPixel == 1) { - const bool supported = getGLPixelFormat(_defaultFormat, glIntFormat, glFormat, glType); + const Graphics::PixelFormat &virtFormat = wantAlpha ? _defaultFormatAlpha : _defaultFormat; + const bool supported = getGLPixelFormat(virtFormat, glIntFormat, glFormat, glType); if (!supported) { return nullptr; } else { - return new TextureCLUT8(glIntFormat, glFormat, glType, _defaultFormat); + return new TextureCLUT8(glIntFormat, glFormat, glType, virtFormat); } } else { const bool supported = getGLPixelFormat(format, glIntFormat, glFormat, glType); diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 5d80968089..6b13db8558 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -174,10 +174,13 @@ private: /** * Create a texture with the specified pixel format. * - * @param format The pixel format the Texture object should accept as input. + * @param format The pixel format the Texture object should accept as + * input. + * @param wantAlpha For CLUT8 textures this marks whether an alpha + * channel should be used. * @return A pointer to the texture or nullptr on failure. */ - Texture *createTexture(const Graphics::PixelFormat &format); + Texture *createTexture(const Graphics::PixelFormat &format, bool wantAlpha = false); // // Transaction support |