aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/texture.h
diff options
context:
space:
mode:
authordhewg2011-03-13 15:51:37 +0100
committerdhewg2011-03-13 16:50:47 +0100
commit2721e287e5bcd1f4d524f869c26156e27f5ba187 (patch)
tree30e1147d3127acc93eeb02488fbd149bc59fe301 /backends/platform/android/texture.h
parenta93229cae53bd35b320e72bd5fe794e8dd79c318 (diff)
downloadscummvm-rg350-2721e287e5bcd1f4d524f869c26156e27f5ba187.tar.gz
scummvm-rg350-2721e287e5bcd1f4d524f869c26156e27f5ba187.tar.bz2
scummvm-rg350-2721e287e5bcd1f4d524f869c26156e27f5ba187.zip
ANDROID: Buffer 16bit texture contents
Same issue as in the last commit: glTexSubImage2D is slow, so cache all copyRect*() calls in a buffer, and update the dirty rect once when drawing. Reduces CPU usage on 16bit games significantly. Also, lockScreen() returns now pixel data for non-CLUT8 games instead of asserting.
Diffstat (limited to 'backends/platform/android/texture.h')
-rw-r--r--backends/platform/android/texture.h47
1 files changed, 36 insertions, 11 deletions
diff --git a/backends/platform/android/texture.h b/backends/platform/android/texture.h
index 15ad2e78b6..e8f20132f8 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -36,26 +36,26 @@
#include "common/rect.h"
#include "common/array.h"
-class GLESTexture {
+class GLESBaseTexture {
public:
static void initGLExtensions();
protected:
- GLESTexture(GLenum glFormat, GLenum glType,
- Graphics::PixelFormat pixelFormat);
+ GLESBaseTexture(GLenum glFormat, GLenum glType,
+ Graphics::PixelFormat pixelFormat);
public:
- virtual ~GLESTexture();
+ virtual ~GLESBaseTexture();
void release();
void reinit();
void initSize();
- virtual void allocBuffer(GLuint width, GLuint height);
+ 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);
+ const void *buf, int pitch_buf) = 0;
+ virtual void fillBuffer(uint32 color) = 0;
virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
@@ -144,6 +144,31 @@ protected:
Graphics::PixelFormat _palettePixelFormat;
};
+class GLESTexture : public GLESBaseTexture {
+protected:
+ GLESTexture(GLenum glFormat, GLenum glType,
+ Graphics::PixelFormat pixelFormat);
+
+public:
+ virtual ~GLESTexture();
+
+ 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);
+
+ inline void drawTexture() {
+ drawTexture(0, 0, _surface.w, _surface.h);
+ }
+
+protected:
+ byte *_pixels;
+ byte *_buf;
+};
+
// RGBA4444 texture
class GLES4444Texture : public GLESTexture {
public:
@@ -177,7 +202,7 @@ public:
}
};
-class GLESPaletteTexture : public GLESTexture {
+class GLESPaletteTexture : public GLESBaseTexture {
protected:
GLESPaletteTexture(GLenum glFormat, GLenum glType,
Graphics::PixelFormat palettePixelFormat);
@@ -185,7 +210,7 @@ protected:
public:
virtual ~GLESPaletteTexture();
- virtual void allocBuffer(GLuint width, GLuint height);
+ 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);
@@ -245,7 +270,7 @@ public:
virtual ~GLESPalette5551Texture();
};
-class GLESFakePaletteTexture : public GLESTexture {
+class GLESFakePaletteTexture : public GLESBaseTexture {
protected:
GLESFakePaletteTexture(GLenum glFormat, GLenum glType,
Graphics::PixelFormat pixelFormat);
@@ -253,7 +278,7 @@ protected:
public:
virtual ~GLESFakePaletteTexture();
- virtual void allocBuffer(GLuint width, GLuint height);
+ 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);