am 0e65e6c2: libgui: Fix surface damage on rotated buffers

* commit '0e65e6c283c96d514c5ecefbb46a976939cfa64a':
  libgui: Fix surface damage on rotated buffers
This commit is contained in:
Dan Stoza 2015-05-27 17:42:35 +00:00 committed by Android Git Automerger
commit f61cc00527

View File

@ -335,10 +335,14 @@ int Surface::queueBuffer(android_native_buffer_t* buffer, int fenceFd) {
// the origin being in the bottom-left corner. Here we flip to the // the origin being in the bottom-left corner. Here we flip to the
// convention that the rest of the system uses (top-left corner) by // convention that the rest of the system uses (top-left corner) by
// subtracting all top/bottom coordinates from the buffer height. // subtracting all top/bottom coordinates from the buffer height.
int height = buffer->height;
if ((mTransform ^ mStickyTransform) & NATIVE_WINDOW_TRANSFORM_ROT_90) {
height = buffer->width;
}
Region flippedRegion; Region flippedRegion;
for (auto rect : mDirtyRegion) { for (auto rect : mDirtyRegion) {
auto top = buffer->height - rect.bottom; auto top = height - rect.bottom;
auto bottom = buffer->height - rect.top; auto bottom = height - rect.top;
Rect flippedRect{rect.left, top, rect.right, bottom}; Rect flippedRect{rect.left, top, rect.right, bottom};
flippedRegion.orSelf(flippedRect); flippedRegion.orSelf(flippedRect);
} }