OPENGL: Cleanup. Remove Texture::getHardwareFormat.
This commit is contained in:
parent
618adec7b0
commit
8b0cf0c5f7
2 changed files with 11 additions and 19 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue