ANDROID: Implement grabOverlay()

This commit is contained in:
dhewg 2011-03-14 18:06:08 +01:00
parent e1575e57f8
commit f587b6ee04

View file

@ -253,6 +253,7 @@ void OSystem_Android::initOverlay() {
LOGI("overlay size is %ux%u", overlay_width, overlay_height); LOGI("overlay size is %ux%u", overlay_width, overlay_height);
_overlay_texture->allocBuffer(overlay_width, overlay_height); _overlay_texture->allocBuffer(overlay_width, overlay_height);
_overlay_texture->clearBuffer();
_overlay_texture->setDrawRect(0, 0, _overlay_texture->setDrawRect(0, 0,
_egl_surface_width, _egl_surface_height); _egl_surface_width, _egl_surface_height);
} }
@ -618,17 +619,15 @@ void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) {
GLTHREADCHECK; GLTHREADCHECK;
// We support overlay alpha blending, so the pixel data here
// shouldn't actually be used. Let's fill it with zeros, I'm sure
// it will be fine...
const Graphics::Surface *surface = _overlay_texture->surface_const(); const Graphics::Surface *surface = _overlay_texture->surface_const();
assert(surface->bytesPerPixel == sizeof(buf[0])); assert(surface->bytesPerPixel == sizeof(buf[0]));
const byte *src = (const byte *)surface->pixels;
uint h = surface->h; uint h = surface->h;
do { do {
memset(buf, 0, surface->w * sizeof(buf[0])); memcpy(buf, src, surface->w * surface->bytesPerPixel);
src += surface->pitch;
// This 'pitch' is pixels not bytes // This 'pitch' is pixels not bytes
buf += pitch; buf += pitch;
} while (--h); } while (--h);