From 8b0cf0c5f7aa34e88a7702c4e9f54f5d8adc5ab8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 2 Jan 2016 05:15:34 +0100 Subject: OPENGL: Cleanup. Remove Texture::getHardwareFormat. --- backends/graphics/opengl/texture.cpp | 21 +++++++++------------ backends/graphics/opengl/texture.h | 9 ++------- 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 *)_palette + start, palData, colors, hardwareFormat); - } else if (hardwareFormat.bytesPerPixel == 4) { - convertPalette((uint32 *)_palette + start, palData, colors, hardwareFormat); + if (_format.bytesPerPixel == 2) { + convertPalette((uint16 *)_palette + start, palData, colors, _format); + } else if (_format.bytesPerPixel == 4) { + convertPalette((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 @@ -172,11 +172,6 @@ public: uint getWidth() const { return _userPixelData.w; } 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. */ @@ -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; -- cgit v1.2.3