diff options
author | John Reck <jreck@google.com> | 2019-04-12 13:06:11 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2019-04-12 13:06:11 -0700 |
commit | 321d8e538dab448a61c6b510fe080e4b62c5644e (patch) | |
tree | 75858b03794b48b85c4b34f74dcd3b18f51a4c50 /libs/hwui/renderthread/VulkanSurface.cpp | |
parent | a39c85fc2b563e628a4fd197b4a8b0d0ba86ec43 (diff) |
Fix set_buffers_damage in VulkanSurface
Fixes: 130363483
Test: `setprop debug.hwui.renderer skiavk` and ensure
surface damage in dumpsys surfaceflinger is expected
in portrait & landscape orientations.
Change-Id: I973c47038e534c86f38112de7b863477d982d150
Diffstat (limited to 'libs/hwui/renderthread/VulkanSurface.cpp')
-rw-r--r-- | libs/hwui/renderthread/VulkanSurface.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/hwui/renderthread/VulkanSurface.cpp b/libs/hwui/renderthread/VulkanSurface.cpp index 36f540c47973..763be0012024 100644 --- a/libs/hwui/renderthread/VulkanSurface.cpp +++ b/libs/hwui/renderthread/VulkanSurface.cpp @@ -531,19 +531,19 @@ VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() { bool VulkanSurface::presentCurrentBuffer(const SkRect& dirtyRect, int semaphoreFd) { if (!dirtyRect.isEmpty()) { - SkRect transformedRect; - mWindowInfo.preTransform.mapRect(&transformedRect, dirtyRect); - SkIRect transformedIRect; - transformedRect.roundOut(&transformedIRect); - transformedIRect.intersect(0, 0, mWindowInfo.size.fWidth, mWindowInfo.size.fHeight); + // native_window_set_surface_damage takes a rectangle in prerotated space + // with a bottom-left origin. That is, top > bottom. + // The dirtyRect is also in prerotated space, so we just need to switch it to + // a bottom-left origin space. - // map to bottom-left coordinate system + SkIRect irect; + dirtyRect.roundOut(&irect); android_native_rect_t aRect; - aRect.left = transformedIRect.x(); - aRect.top = mWindowInfo.size.fHeight - (transformedIRect.y() + transformedIRect.height()); - aRect.right = aRect.left + transformedIRect.width(); - aRect.bottom = aRect.top - transformedIRect.height(); + aRect.left = irect.left(); + aRect.top = logicalHeight() - irect.top(); + aRect.right = irect.right(); + aRect.bottom = logicalHeight() - irect.bottom(); int err = native_window_set_surface_damage(mNativeWindow.get(), &aRect, 1); ALOGE_IF(err != 0, "native_window_set_surface_damage failed: %s (%d)", strerror(-err), err); |