[Scummvm-cvs-logs] scummvm master -> abcadb5d8728fdc18bf544d8b40418880fa1a145
lordhoto
lordhoto at gmail.com
Tue Feb 11 12:20:47 CET 2014
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:
abcadb5d87 OPENGL: Fix cursor regression when defaultFormat doesn't have an alpha channel.
Commit: abcadb5d8728fdc18bf544d8b40418880fa1a145
https://github.com/scummvm/scummvm/commit/abcadb5d8728fdc18bf544d8b40418880fa1a145
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-11T03:19:30-08:00
Commit Message:
OPENGL: Fix cursor regression when defaultFormat doesn't have an alpha channel.
Changed paths:
backends/graphics/opengl/opengl-graphics.cpp
backends/graphics/opengl/opengl-graphics.h
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 3321689..925b2c5 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 5d80968..6b13db8 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
More information about the Scummvm-git-logs
mailing list