aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl
diff options
context:
space:
mode:
authorJohannes Schickel2016-01-02 05:15:34 +0100
committerJohannes Schickel2016-03-16 20:29:26 +0100
commit8b0cf0c5f7aa34e88a7702c4e9f54f5d8adc5ab8 (patch)
treeed2d946331eb3277b8bd7b5ba69284c47fde69c3 /backends/graphics/opengl
parent618adec7b06546e81028cb9fcce6151cb388fe98 (diff)
downloadscummvm-rg350-8b0cf0c5f7aa34e88a7702c4e9f54f5d8adc5ab8.tar.gz
scummvm-rg350-8b0cf0c5f7aa34e88a7702c4e9f54f5d8adc5ab8.tar.bz2
scummvm-rg350-8b0cf0c5f7aa34e88a7702c4e9f54f5d8adc5ab8.zip
OPENGL: Cleanup. Remove Texture::getHardwareFormat.
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r--backends/graphics/opengl/texture.cpp21
-rw-r--r--backends/graphics/opengl/texture.h9
2 files changed, 11 insertions, 19 deletions
diff --git a/backends/graphics/opengl/texture.cpp b/backends/graphics/opengl/texture.cpp
index a607528915..0411df3ee1 100644
--- a/backends/graphics/opengl/texture.cpp
+++ b/backends/graphics/opengl/texture.cpp
@@ -349,17 +349,16 @@ Graphics::PixelFormat TextureCLUT8::getFormat() const {
void TextureCLUT8::setColorKey(uint colorKey) {
// We remove all alpha bits from the palette entry of the color key.
// This makes sure its properly handled as color key.
- const Graphics::PixelFormat &hardwareFormat = getHardwareFormat();
- const uint32 aMask = (0xFF >> hardwareFormat.aLoss) << hardwareFormat.aShift;
+ const uint32 aMask = (0xFF >> _format.aLoss) << _format.aShift;
- if (hardwareFormat.bytesPerPixel == 2) {
+ if (_format.bytesPerPixel == 2) {
uint16 *palette = (uint16 *)_palette + colorKey;
*palette &= ~aMask;
- } else if (hardwareFormat.bytesPerPixel == 4) {
+ } else if (_format.bytesPerPixel == 4) {
uint32 *palette = (uint32 *)_palette + colorKey;
*palette &= ~aMask;
} else {
- warning("TextureCLUT8::setColorKey: Unsupported pixel depth %d", hardwareFormat.bytesPerPixel);
+ warning("TextureCLUT8::setColorKey: Unsupported pixel depth %d", _format.bytesPerPixel);
}
// A palette changes means we need to refresh the whole surface.
@@ -377,14 +376,12 @@ inline void convertPalette(ColorType *dst, const byte *src, uint colors, const G
} // End of anonymous namespace
void TextureCLUT8::setPalette(uint start, uint colors, const byte *palData) {
- const Graphics::PixelFormat &hardwareFormat = getHardwareFormat();
-
- if (hardwareFormat.bytesPerPixel == 2) {
- convertPalette<uint16>((uint16 *)_palette + start, palData, colors, hardwareFormat);
- } else if (hardwareFormat.bytesPerPixel == 4) {
- convertPalette<uint32>((uint32 *)_palette + start, palData, colors, hardwareFormat);
+ if (_format.bytesPerPixel == 2) {
+ convertPalette<uint16>((uint16 *)_palette + start, palData, colors, _format);
+ } else if (_format.bytesPerPixel == 4) {
+ convertPalette<uint32>((uint32 *)_palette + start, palData, colors, _format);
} else {
- warning("TextureCLUT8::setPalette: Unsupported pixel depth: %d", hardwareFormat.bytesPerPixel);
+ warning("TextureCLUT8::setPalette: Unsupported pixel depth: %d", _format.bytesPerPixel);
}
// A palette changes means we need to refresh the whole surface.
diff --git a/backends/graphics/opengl/texture.h b/backends/graphics/opengl/texture.h
index 68af406804..acbfe40636 100644
--- a/backends/graphics/opengl/texture.h
+++ b/backends/graphics/opengl/texture.h
@@ -173,11 +173,6 @@ public:
uint getHeight() const { return _userPixelData.h; }
/**
- * @return The hardware format of the texture data.
- */
- const Graphics::PixelFormat &getHardwareFormat() const { return _format; }
-
- /**
* @return The logical format of the texture data.
*/
virtual Graphics::PixelFormat getFormat() const { return _format; }
@@ -200,12 +195,12 @@ public:
virtual void setColorKey(uint colorKey) {}
virtual void setPalette(uint start, uint colors, const byte *palData) {}
protected:
+ const Graphics::PixelFormat _format;
+
virtual void updateTexture();
Common::Rect getDirtyArea() const;
private:
- const Graphics::PixelFormat _format;
-
GLTexture _glTexture;
Graphics::Surface _textureData;