aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorAlyssa Milburn2014-01-23 22:46:34 +0100
committerAlyssa Milburn2014-01-23 23:00:00 +0100
commit6927e570bbbd69886b5fe2c2ce484ae236af61db (patch)
treebba1040586e3451ed05c966559a0451392100778 /backends/platform
parentaa87af50b21a7ce03433e108b690322d44dbbb45 (diff)
downloadscummvm-rg350-6927e570bbbd69886b5fe2c2ce484ae236af61db.tar.gz
scummvm-rg350-6927e570bbbd69886b5fe2c2ce484ae236af61db.tar.bz2
scummvm-rg350-6927e570bbbd69886b5fe2c2ce484ae236af61db.zip
ANDROID: Add 32bpp support.
We still prefer 16bpp for performance reasons.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/android/gfx.cpp3
-rw-r--r--backends/platform/android/texture.cpp17
-rw-r--r--backends/platform/android/texture.h12
3 files changed, 29 insertions, 3 deletions
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 0ce95a3cfb..9f6c759c75 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -94,6 +94,7 @@ Common::List<Graphics::PixelFormat> OSystem_Android::getSupportedFormats() const
Common::List<Graphics::PixelFormat> res;
res.push_back(GLES565Texture::pixelFormat());
res.push_back(GLES5551Texture::pixelFormat());
+ res.push_back(GLES8888Texture::pixelFormat());
res.push_back(GLES4444Texture::pixelFormat());
res.push_back(Graphics::PixelFormat::createFormatCLUT8());
@@ -147,6 +148,8 @@ void OSystem_Android::initTexture(GLESBaseTexture **texture,
*texture = new GLES565Texture();
else if (format_new == GLES5551Texture::pixelFormat())
*texture = new GLES5551Texture();
+ else if (format_new == GLES8888Texture::pixelFormat())
+ *texture = new GLES8888Texture();
else if (format_new == GLES4444Texture::pixelFormat())
*texture = new GLES4444Texture();
else {
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index cc41c0d8a6..87fd2d976c 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -259,11 +259,15 @@ void GLESTexture::fillBuffer(uint32 color) {
assert(_surface.getPixels());
if (_pixelFormat.bytesPerPixel == 1 ||
- ((color & 0xff) == ((color >> 8) & 0xff)))
+ (_pixelFormat.bytesPerPixel == 2 &&
+ ((color & 0xff) == ((color >> 8) & 0xff))))
memset(_pixels, color & 0xff, _surface.pitch * _surface.h);
- else
- Common::fill(_pixels, _pixels + _surface.pitch * _surface.h,
+ else if (_pixelFormat.bytesPerPixel == 2)
+ Common::fill((uint16 *)_pixels, (uint16 *)(_pixels + _surface.pitch * _surface.h),
(uint16)color);
+ else
+ Common::fill((uint32 *)_pixels, (uint32 *)(_pixels + _surface.pitch * _surface.h),
+ color);
setDirty();
}
@@ -334,6 +338,13 @@ GLES565Texture::GLES565Texture() :
GLES565Texture::~GLES565Texture() {
}
+GLES8888Texture::GLES8888Texture() :
+ GLESTexture(GL_RGBA, GL_UNSIGNED_BYTE, pixelFormat()) {
+}
+
+GLES8888Texture::~GLES8888Texture() {
+}
+
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 4307b5a1bc..67f7343c98 100644
--- a/backends/platform/android/texture.h
+++ b/backends/platform/android/texture.h
@@ -224,6 +224,18 @@ public:
}
};
+// RGBA8888 texture
+class GLES8888Texture : public GLESTexture {
+public:
+ GLES8888Texture();
+ virtual ~GLES8888Texture();
+
+ static inline Graphics::PixelFormat pixelFormat() {
+ // We assume LE since all Android platforms are LE.
+ return Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
+ }
+};
+
class GLESFakePaletteTexture : public GLESBaseTexture {
protected:
GLESFakePaletteTexture(GLenum glFormat, GLenum glType,