diff options
author | Johannes Schickel | 2011-05-01 16:54:45 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-05-01 16:54:45 +0200 |
commit | 71bdb86e028db9556611f88b3686ce93312a8131 (patch) | |
tree | 3c24233044a8e72bd8ecd73b981f50c725d5d282 /backends/platform/android | |
parent | 89b63e3adb4692c9659f8b133727ccc1e2af75b4 (diff) | |
parent | 8ff527ac4ef4237e63c0802a22eb0f942089e6c4 (diff) | |
download | scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.tar.gz scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.tar.bz2 scummvm-rg350-71bdb86e028db9556611f88b3686ce93312a8131.zip |
Merge pull request #16 "Add a PixelFormat to Graphics::Surface.".
For further discussion check here:
https://github.com/scummvm/scummvm/pull/16
Conflicts:
graphics/png.cpp
Diffstat (limited to 'backends/platform/android')
-rw-r--r-- | backends/platform/android/gfx.cpp | 4 | ||||
-rw-r--r-- | backends/platform/android/texture.cpp | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 86232030ff..fae428d29f 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -628,13 +628,13 @@ void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) { GLTHREADCHECK; const Graphics::Surface *surface = _overlay_texture->surface_const(); - assert(surface->bytesPerPixel == sizeof(buf[0])); + assert(surface->format.bytesPerPixel == sizeof(buf[0])); const byte *src = (const byte *)surface->pixels; uint h = surface->h; do { - memcpy(buf, src, surface->w * surface->bytesPerPixel); + memcpy(buf, src, surface->w * surface->format.bytesPerPixel); src += surface->pitch; // This 'pitch' is pixels not bytes buf += pitch; diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index a6b28ca485..2d73783309 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -147,7 +147,7 @@ void GLESBaseTexture::setLinearFilter(bool value) { void GLESBaseTexture::allocBuffer(GLuint w, GLuint h) { _surface.w = w; _surface.h = h; - _surface.bytesPerPixel = _pixelFormat.bytesPerPixel; + _surface.format = _pixelFormat; if (w == _texture_width && h == _texture_height) return; @@ -241,14 +241,14 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) { delete[] _buf; delete[] _pixels; - _pixels = new byte[w * h * _surface.bytesPerPixel]; + _pixels = new byte[w * h * _surface.format.bytesPerPixel]; assert(_pixels); _surface.pixels = _pixels; fillBuffer(0); - _buf = new byte[w * h * _surface.bytesPerPixel]; + _buf = new byte[w * h * _surface.format.bytesPerPixel]; assert(_buf); } @@ -257,10 +257,10 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, setDirtyRect(Common::Rect(x, y, x + w, y + h)); const byte *src = (const byte *)buf; - byte *dst = _pixels + y * _surface.pitch + x * _surface.bytesPerPixel; + byte *dst = _pixels + y * _surface.pitch + x * _surface.format.bytesPerPixel; do { - memcpy(dst, src, w * _surface.bytesPerPixel); + memcpy(dst, src, w * _surface.format.bytesPerPixel); dst += _surface.pitch; src += pitch_buf; } while (--h); @@ -301,10 +301,10 @@ void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { _tex = _buf; byte *src = _pixels + _dirty_rect.top * _surface.pitch + - _dirty_rect.left * _surface.bytesPerPixel; + _dirty_rect.left * _surface.format.bytesPerPixel; byte *dst = _buf; - uint16 l = dwidth * _surface.bytesPerPixel; + uint16 l = dwidth * _surface.format.bytesPerPixel; for (uint16 i = 0; i < dheight; ++i) { memcpy(dst, src, l); @@ -373,7 +373,7 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); - _surface.bytesPerPixel = 1; + _surface.format = Graphics::PixelFormat::createFormatCLUT8(); _surface.pitch = w; if (_surface.w == oldw && _surface.h == oldh) { |