summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLReadback.cpp
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2016-12-09 22:04:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-12-09 22:04:36 +0000
commitce44045d855586394e5b023d1cee69c5fd9dce6d (patch)
tree32ef19b2e683c3136004bad88a5e59da9f939ea7 /libs/hwui/OpenGLReadback.cpp
parentc1b9569d72bc1f4c6198bd69232200c77648b72d (diff)
parent912bebeb7488f498954282a1eb82a4b641e6418e (diff)
Merge "Fix window copy for rotation = 90/270"
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