From 912bebeb7488f498954282a1eb82a4b641e6418e Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 7 Dec 2016 16:36:15 -0800 Subject: Fix window copy for rotation = 90/270 Bug: 33421965 Test: Manual via PixelCopyWindow test in HwAccelerationTest Change-Id: I2a59fd6a26499635a22444e124cd1ec6f82f6e31 --- libs/hwui/OpenGLReadback.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libs/hwui/OpenGLReadback.cpp') 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 -- cgit v1.2.3-59-g8ed1b