diff options
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/android/texture.cpp | 119 | ||||
-rw-r--r-- | backends/platform/android/texture.h | 64 |
2 files changed, 0 insertions, 183 deletions
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index 2018dfdaab..a6b28ca485 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -345,125 +345,6 @@ GLES565Texture::GLES565Texture() : GLES565Texture::~GLES565Texture() { } -GLESPaletteTexture::GLESPaletteTexture(GLenum glFormat, GLenum glType, - Graphics::PixelFormat palettePixelFormat) : - GLESBaseTexture(glFormat, glType, - Graphics::PixelFormat::createFormatCLUT8()), - _texture(0) -{ - _palettePixelFormat = palettePixelFormat; - _paletteSize = _palettePixelFormat.bytesPerPixel * 256; -} - -GLESPaletteTexture::~GLESPaletteTexture() { - delete[] _texture; -} - -void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) { - GLuint oldw = _surface.w; - GLuint oldh = _surface.h; - - GLESBaseTexture::allocBuffer(w, h); - - _surface.pitch = _texture_width; - - if (_surface.w == oldw && _surface.h == oldh) { - fillBuffer(0); - return; - } - - byte *old_texture = _texture; - - _texture = new byte[_paletteSize + _texture_width * _texture_height]; - assert(_texture); - - _surface.pixels = _texture + _paletteSize; - - fillBuffer(0); - - if (old_texture) { - // preserve palette - memcpy(_texture, old_texture, _paletteSize); - delete[] old_texture; - } -} - -void GLESPaletteTexture::fillBuffer(uint32 color) { - assert(_surface.pixels); - memset(_surface.pixels, color & 0xff, _surface.pitch * _surface.h); - setDirty(); -} - -void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, - const void *buf, int pitch_buf) { - setDirtyRect(Common::Rect(x, y, x + w, y + h)); - - const byte * src = static_cast<const byte *>(buf); - byte *dst = static_cast<byte *>(_surface.getBasePtr(x, y)); - - do { - memcpy(dst, src, w); - dst += _surface.pitch; - src += pitch_buf; - } while (--h); -} - -void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w, - GLshort h) { - if (dirty()) { - GLCALL(glBindTexture(GL_TEXTURE_2D, _texture_name)); - - const size_t texture_size = _paletteSize + - _texture_width * _texture_height; - - GLCALL(glCompressedTexImage2D(GL_TEXTURE_2D, 0, _glType, - _texture_width, _texture_height, - 0, texture_size, _texture)); - } - - GLESBaseTexture::drawTexture(x, y, w, h); -} - -GLESPalette888Texture::GLESPalette888Texture() : - GLESPaletteTexture(GL_RGB, GL_PALETTE8_RGB8_OES, - Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0)) { -} - -GLESPalette888Texture::~GLESPalette888Texture() { -} - -GLESPalette8888Texture::GLESPalette8888Texture() : - GLESPaletteTexture(GL_RGBA, GL_PALETTE8_RGBA8_OES, - Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) { -} - -GLESPalette8888Texture::~GLESPalette8888Texture() { -} - -GLESPalette565Texture::GLESPalette565Texture() : - GLESPaletteTexture(GL_RGB, GL_PALETTE8_R5_G6_B5_OES, - Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) { -} - -GLESPalette565Texture::~GLESPalette565Texture() { -} - -GLESPalette4444Texture::GLESPalette4444Texture() : - GLESPaletteTexture(GL_RGBA, GL_PALETTE8_RGBA4_OES, - Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) { -} - -GLESPalette4444Texture::~GLESPalette4444Texture() { -} - -GLESPalette5551Texture::GLESPalette5551Texture() : - GLESPaletteTexture(GL_RGBA, GL_PALETTE8_RGB5_A1_OES, - Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)) { -} - -GLESPalette5551Texture::~GLESPalette5551Texture() { -} - GLESFakePaletteTexture::GLESFakePaletteTexture(GLenum glFormat, GLenum glType, Graphics::PixelFormat pixelFormat) : GLESBaseTexture(glFormat, glType, pixelFormat), diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h index d825357760..6344326259 100644 --- a/backends/platform/android/texture.h +++ b/backends/platform/android/texture.h @@ -227,70 +227,6 @@ public: } }; -class GLESPaletteTexture : public GLESBaseTexture { -protected: - GLESPaletteTexture(GLenum glFormat, GLenum glType, - Graphics::PixelFormat palettePixelFormat); - -public: - virtual ~GLESPaletteTexture(); - - virtual void allocBuffer(GLuint w, GLuint h); - virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height, - const void *buf, int pitch_buf); - virtual void fillBuffer(uint32 color); - - virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h); - - virtual const byte *palette_const() const { - return _texture; - }; - - virtual byte *palette() { - setDirty(); - return _texture; - }; - -protected: - byte *_texture; - size_t _paletteSize; -}; - -// RGB888 256-entry paletted texture -class GLESPalette888Texture : public GLESPaletteTexture { -public: - GLESPalette888Texture(); - virtual ~GLESPalette888Texture(); -}; - -// RGBA8888 256-entry paletted texture -class GLESPalette8888Texture : public GLESPaletteTexture { -public: - GLESPalette8888Texture(); - virtual ~GLESPalette8888Texture(); -}; - -// RGB565 256-entry paletted texture -class GLESPalette565Texture : public GLESPaletteTexture { -public: - GLESPalette565Texture(); - virtual ~GLESPalette565Texture(); -}; - -// RGBA4444 256-entry paletted texture -class GLESPalette4444Texture : public GLESPaletteTexture { -public: - GLESPalette4444Texture(); - virtual ~GLESPalette4444Texture(); -}; - -// RGBA5551 256-entry paletted texture -class GLESPalette5551Texture : public GLESPaletteTexture { -public: - GLESPalette5551Texture(); - virtual ~GLESPalette5551Texture(); -}; - class GLESFakePaletteTexture : public GLESBaseTexture { protected: GLESFakePaletteTexture(GLenum glFormat, GLenum glType, |