ANDROID: Add 32bpp support.
We still prefer 16bpp for performance reasons.
This commit is contained in:
parent
aa87af50b2
commit
6927e570bb
3 changed files with 29 additions and 3 deletions
|
@ -94,6 +94,7 @@ Common::List<Graphics::PixelFormat> OSystem_Android::getSupportedFormats() const
|
||||||
Common::List<Graphics::PixelFormat> res;
|
Common::List<Graphics::PixelFormat> res;
|
||||||
res.push_back(GLES565Texture::pixelFormat());
|
res.push_back(GLES565Texture::pixelFormat());
|
||||||
res.push_back(GLES5551Texture::pixelFormat());
|
res.push_back(GLES5551Texture::pixelFormat());
|
||||||
|
res.push_back(GLES8888Texture::pixelFormat());
|
||||||
res.push_back(GLES4444Texture::pixelFormat());
|
res.push_back(GLES4444Texture::pixelFormat());
|
||||||
res.push_back(Graphics::PixelFormat::createFormatCLUT8());
|
res.push_back(Graphics::PixelFormat::createFormatCLUT8());
|
||||||
|
|
||||||
|
@ -147,6 +148,8 @@ void OSystem_Android::initTexture(GLESBaseTexture **texture,
|
||||||
*texture = new GLES565Texture();
|
*texture = new GLES565Texture();
|
||||||
else if (format_new == GLES5551Texture::pixelFormat())
|
else if (format_new == GLES5551Texture::pixelFormat())
|
||||||
*texture = new GLES5551Texture();
|
*texture = new GLES5551Texture();
|
||||||
|
else if (format_new == GLES8888Texture::pixelFormat())
|
||||||
|
*texture = new GLES8888Texture();
|
||||||
else if (format_new == GLES4444Texture::pixelFormat())
|
else if (format_new == GLES4444Texture::pixelFormat())
|
||||||
*texture = new GLES4444Texture();
|
*texture = new GLES4444Texture();
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -259,11 +259,15 @@ void GLESTexture::fillBuffer(uint32 color) {
|
||||||
assert(_surface.getPixels());
|
assert(_surface.getPixels());
|
||||||
|
|
||||||
if (_pixelFormat.bytesPerPixel == 1 ||
|
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);
|
memset(_pixels, color & 0xff, _surface.pitch * _surface.h);
|
||||||
else
|
else if (_pixelFormat.bytesPerPixel == 2)
|
||||||
Common::fill(_pixels, _pixels + _surface.pitch * _surface.h,
|
Common::fill((uint16 *)_pixels, (uint16 *)(_pixels + _surface.pitch * _surface.h),
|
||||||
(uint16)color);
|
(uint16)color);
|
||||||
|
else
|
||||||
|
Common::fill((uint32 *)_pixels, (uint32 *)(_pixels + _surface.pitch * _surface.h),
|
||||||
|
color);
|
||||||
|
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
@ -334,6 +338,13 @@ GLES565Texture::GLES565Texture() :
|
||||||
GLES565Texture::~GLES565Texture() {
|
GLES565Texture::~GLES565Texture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLES8888Texture::GLES8888Texture() :
|
||||||
|
GLESTexture(GL_RGBA, GL_UNSIGNED_BYTE, pixelFormat()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
GLES8888Texture::~GLES8888Texture() {
|
||||||
|
}
|
||||||
|
|
||||||
GLESFakePaletteTexture::GLESFakePaletteTexture(GLenum glFormat, GLenum glType,
|
GLESFakePaletteTexture::GLESFakePaletteTexture(GLenum glFormat, GLenum glType,
|
||||||
Graphics::PixelFormat pixelFormat) :
|
Graphics::PixelFormat pixelFormat) :
|
||||||
GLESBaseTexture(glFormat, glType, pixelFormat),
|
GLESBaseTexture(glFormat, glType, pixelFormat),
|
||||||
|
|
|
@ -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 {
|
class GLESFakePaletteTexture : public GLESBaseTexture {
|
||||||
protected:
|
protected:
|
||||||
GLESFakePaletteTexture(GLenum glFormat, GLenum glType,
|
GLESFakePaletteTexture(GLenum glFormat, GLenum glType,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue