aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/texture.h
diff options
context:
space:
mode:
authordhewg2011-03-05 10:02:56 +0100
committerdhewg2011-03-05 11:00:36 +0100
commit68378150beb96159db7d959d9625107b721eef57 (patch)
treec16836d4aa47ffd00564819f2d84e591e51cec8e /backends/platform/android/texture.h
parentdbaad1a89633fe51eabb64a910568fe3995734ec (diff)
downloadscummvm-rg350-68378150beb96159db7d959d9625107b721eef57.tar.gz
scummvm-rg350-68378150beb96159db7d959d9625107b721eef57.tar.bz2
scummvm-rg350-68378150beb96159db7d959d9625107b721eef57.zip
ANDROID: Remove some vtable overhead on textures
Diffstat (limited to 'backends/platform/android/texture.h')
-rw-r--r--backends/platform/android/texture.h95
1 files changed, 30 insertions, 65 deletions
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index cc1f4e3dae..f1bc46e997 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -39,9 +39,12 @@ class GLESTexture {
public:
static void initGLExtensions();
- GLESTexture();
+protected:
+ GLESTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+ size_t paletteSize);
virtual ~GLESTexture();
+public:
void release();
void reinit();
void initSize();
@@ -80,14 +83,6 @@ public:
}
protected:
- virtual byte bytesPerPixel() const = 0;
- virtual GLenum glFormat() const = 0;
- virtual GLenum glType() const = 0;
-
- virtual size_t paletteSize() const {
- return 0;
- }
-
inline void setDirty() {
_all_dirty = true;
_dirty_rect = Common::Rect();
@@ -102,6 +97,11 @@ protected:
}
}
+ byte _bytesPerPixel;
+ GLenum _glFormat;
+ GLenum _glType;
+ size_t _paletteSize;
+
GLuint _texture_name;
Graphics::Surface _surface;
GLuint _texture_width;
@@ -114,42 +114,25 @@ protected:
// RGBA4444 texture
class GLES4444Texture : public GLESTexture {
-protected:
- virtual byte bytesPerPixel() const {
- return 2;
- }
-
- virtual GLenum glFormat() const {
- return GL_RGBA;
- }
-
- virtual GLenum glType() const {
- return GL_UNSIGNED_SHORT_4_4_4_4;
- }
+public:
+ GLES4444Texture();
+ virtual ~GLES4444Texture();
};
// RGB565 texture
class GLES565Texture : public GLESTexture {
-protected:
- virtual byte bytesPerPixel() const {
- return 2;
- }
-
- virtual GLenum glFormat() const {
- return GL_RGB;
- }
-
- virtual GLenum glType() const {
- return GL_UNSIGNED_SHORT_5_6_5;
- }
+public:
+ GLES565Texture();
+ virtual ~GLES565Texture();
};
-// RGB888 256-entry paletted texture
class GLESPaletteTexture : public GLESTexture {
-public:
- GLESPaletteTexture();
+protected:
+ GLESPaletteTexture(byte bytesPerPixel, GLenum glFormat, GLenum glType,
+ size_t paletteSize);
virtual ~GLESPaletteTexture();
+public:
virtual void allocBuffer(GLuint width, GLuint height);
virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height,
const void *buf, int pitch);
@@ -171,41 +154,23 @@ public:
};
protected:
- virtual byte bytesPerPixel() const {
- return 1;
- }
-
- virtual GLenum glFormat() const {
- return GL_RGB;
- }
-
- virtual GLenum glType() const {
- return GL_PALETTE8_RGB8_OES;
- }
-
- virtual size_t paletteSize() const {
- return 256 * 3;
- }
-
void uploadTexture() const;
byte *_texture;
};
-// RGBA8888 256-entry paletted texture
-class GLESPaletteATexture : public GLESPaletteTexture {
-protected:
- virtual GLenum glFormat() const {
- return GL_RGBA;
- }
-
- virtual GLenum glType() const {
- return GL_PALETTE8_RGBA8_OES;
- }
+// RGB888 256-entry paletted texture
+class GLESPalette888Texture : public GLESPaletteTexture {
+public:
+ GLESPalette888Texture();
+ virtual ~GLESPalette888Texture();
+};
- virtual size_t paletteSize() const {
- return 256 * 4;
- }
+// RGBA8888 256-entry paletted texture
+class GLESPalette8888Texture : public GLESPaletteTexture {
+public:
+ GLESPalette8888Texture();
+ virtual ~GLESPalette8888Texture();
};
#endif