summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLReadback.cpp
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2016-12-07 16:36:15 -0800
committer John Reck <jreck@google.com> 2016-12-08 11:22:31 -0800
commit912bebeb7488f498954282a1eb82a4b641e6418e (patch)
tree7c11751a6f0f7056c6aa759bfd42a01b8379a63c /libs/hwui/OpenGLReadback.cpp
parentea98e436002a8f2c51370edc134c9e3a137b9cc5 (diff)
Fix window copy for rotation = 90/270
Bug: 33421965 Test: Manual via PixelCopyWindow test in HwAccelerationTest Change-Id: I2a59fd6a26499635a22444e124cd1ec6f82f6e31
Diffstat (limited to 'libs/hwui/OpenGLReadback.cpp')
-rw-r--r--libs/hwui/OpenGLReadback.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/hwui/OpenGLReadback.cpp b/libs/hwui/OpenGLReadback.cpp
index 408159b8f33a..74a8395f9fff 100644
--- a/libs/hwui/OpenGLReadback.cpp
+++ b/libs/hwui/OpenGLReadback.cpp
@@ -82,8 +82,15 @@ CopyResult OpenGLReadback::copyGraphicBufferInto(GraphicBuffer* graphicBuffer,
return CopyResult::UnknownError;
}
- CopyResult copyResult = copyImageInto(sourceImage, texTransform, graphicBuffer->getWidth(),
- graphicBuffer->getHeight(), srcRect, bitmap);
+ uint32_t width = graphicBuffer->getWidth();
+ uint32_t height = graphicBuffer->getHeight();
+ // If this is a 90 or 270 degree rotation we need to swap width/height
+ // This is a fuzzy way of checking that.
+ if (texTransform[Matrix4::kSkewX] >= 0.5f || texTransform[Matrix4::kSkewX] <= -0.5f) {
+ std::swap(width, height);
+ }
+ CopyResult copyResult = copyImageInto(sourceImage, texTransform, width, height,
+ srcRect, bitmap);
// All we're flushing & finishing is the deletion of the texture since
// copyImageInto already did a major flush & finish as an implicit