Fix an issue where Surface::lock() would never update the output region

this bug was introduced recently. in some situations Surface::lock()
is not able to preserve the content of the back buffer and needs
to tell the caller to redraw everything.

Bug: 5186460
Change-Id: I14e03939ddfc1b7ad2a8b99ad79435314c60e78e
This commit is contained in:
Mathias Agopian 2011-08-23 21:09:41 -07:00
parent a45836466c
commit 87a96ea9ea
1 changed files with 8 additions and 3 deletions

View File

@ -351,13 +351,13 @@ int Surface::query(int what, int* value) const {
// ----------------------------------------------------------------------------
status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn) {
status_t Surface::lock(SurfaceInfo* other, Region* inOutDirtyRegion) {
ANativeWindow_Buffer outBuffer;
ARect temp;
ARect* inOutDirtyBounds = NULL;
if (dirtyIn) {
temp = dirtyIn->getBounds();
if (inOutDirtyRegion) {
temp = inOutDirtyRegion->getBounds();
inOutDirtyBounds = &temp;
}
@ -371,6 +371,11 @@ status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn) {
other->format = uint32_t(outBuffer.format);
other->bits = outBuffer.bits;
}
if (inOutDirtyRegion) {
inOutDirtyRegion->set( static_cast<Rect const&>(temp) );
}
return err;
}