aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android
diff options
context:
space:
mode:
authordhewg2011-03-12 09:17:58 +0100
committerdhewg2011-03-12 09:36:22 +0100
commit7fe487f9cc4cb4b7ee6a121f33b9d284bfc15ed7 (patch)
tree145639138a02eab671f767a18b82760a190a91de /backends/platform/android
parent99c0d825418de549c42f26532eb444cdfa82e507 (diff)
downloadscummvm-rg350-7fe487f9cc4cb4b7ee6a121f33b9d284bfc15ed7.tar.gz
scummvm-rg350-7fe487f9cc4cb4b7ee6a121f33b9d284bfc15ed7.tar.bz2
scummvm-rg350-7fe487f9cc4cb4b7ee6a121f33b9d284bfc15ed7.zip
ANDROID: Add more paletted texture types
Diffstat (limited to 'backends/platform/android')
-rw-r--r--backends/platform/android/texture.cpp39
-rw-r--r--backends/platform/android/texture.h30
2 files changed, 62 insertions, 7 deletions
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index eb45de7468..603ef3aa6f 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -93,7 +93,8 @@ GLESTexture::GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
_texture_height(0),
_all_dirty(false),
_dirty_rect(),
- _pixelFormat(pixelFormat)
+ _pixelFormat(pixelFormat),
+ _palettePixelFormat()
{
GLCALL(glGenTextures(1, &_texture_name));
}
@@ -300,12 +301,14 @@ GLES565Texture::~GLES565Texture() {
}
GLESPaletteTexture::GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat,
- GLenum glType, size_t paletteSize) :
+ GLenum glType,
+ Graphics::PixelFormat palettePixelFormat) :
GLESTexture(bytesPerPixel, glFormat, glType,
Graphics::PixelFormat::createFormatCLUT8()),
- _paletteSize(paletteSize),
_texture(0)
{
+ _palettePixelFormat = palettePixelFormat;
+ _paletteSize = _palettePixelFormat.bytesPerPixel * 256;
}
GLESPaletteTexture::~GLESPaletteTexture() {
@@ -368,18 +371,44 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w,
}
GLESPalette888Texture::GLESPalette888Texture() :
- GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_RGB8_OES, 256 * 3) {
+ GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_RGB8_OES,
+ Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0)) {
}
GLESPalette888Texture::~GLESPalette888Texture() {
}
GLESPalette8888Texture::GLESPalette8888Texture() :
- GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA8_OES, 256 * 4) {
+ GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA8_OES,
+ Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)) {
}
GLESPalette8888Texture::~GLESPalette8888Texture() {
}
+GLESPalette565Texture::GLESPalette565Texture() :
+ GLESPaletteTexture(1, GL_RGB, GL_PALETTE8_R5_G6_B5_OES,
+ Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)) {
+}
+
+GLESPalette565Texture::~GLESPalette565Texture() {
+}
+
+GLESPalette4444Texture::GLESPalette4444Texture() :
+ GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGBA4_OES,
+ Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)) {
+}
+
+GLESPalette4444Texture::~GLESPalette4444Texture() {
+}
+
+GLESPalette5551Texture::GLESPalette5551Texture() :
+ GLESPaletteTexture(1, GL_RGBA, GL_PALETTE8_RGB5_A1_OES,
+ Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)) {
+}
+
+GLESPalette5551Texture::~GLESPalette5551Texture() {
+}
+
#endif
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index 91ec9ff857..f00a589875 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -93,7 +93,7 @@ public:
};
inline bool hasPalette() const {
- return palette_const() != 0;
+ return _palettePixelFormat.bytesPerPixel > 0;
}
inline bool dirty() const {
@@ -104,6 +104,10 @@ public:
return _pixelFormat;
}
+ inline const Graphics::PixelFormat &getPalettePixelFormat() const {
+ return _palettePixelFormat;
+ }
+
protected:
inline void setDirty() {
_all_dirty = true;
@@ -140,6 +144,7 @@ protected:
Common::Rect _dirty_rect;
Graphics::PixelFormat _pixelFormat;
+ Graphics::PixelFormat _palettePixelFormat;
};
// RGBA4444 texture
@@ -178,7 +183,7 @@ public:
class GLESPaletteTexture : public GLESTexture {
protected:
GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
- size_t paletteSize);
+ Graphics::PixelFormat palettePixelFormat);
public:
virtual ~GLESPaletteTexture();
@@ -222,6 +227,27 @@ public:
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();
+};
+
#endif
#endif