diff options
author | 2016-12-15 10:26:33 -0800 | |
---|---|---|
committer | 2016-12-15 10:26:33 -0800 | |
commit | eb418edae488c0c13edcc10e829bbb0e21eb23ac (patch) | |
tree | b97a00fc834bca37bbd68f435415b6df73469936 /libs/hwui/OpenGLReadback.cpp | |
parent | 9f8ec54244a5e0343b9748db3329733f259604f3 (diff) |
Actually fix pixelcopy for 90/180/270 rotation
Bug: 33421965
Test: PixelCopyTest testWindow* CTS tests
Change-Id: I1b49b3643c5d030c3d2de95de4a0ce3a4ff0111d
Diffstat (limited to 'libs/hwui/OpenGLReadback.cpp')
-rw-r--r-- | libs/hwui/OpenGLReadback.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libs/hwui/OpenGLReadback.cpp b/libs/hwui/OpenGLReadback.cpp index 74a8395f9fff..4c8abc5da832 100644 --- a/libs/hwui/OpenGLReadback.cpp +++ b/libs/hwui/OpenGLReadback.cpp @@ -108,6 +108,15 @@ CopyResult OpenGLReadback::copyGraphicBufferInto(GraphicBuffer* graphicBuffer, S return copyGraphicBufferInto(graphicBuffer, transform, srcRect, bitmap); } +static float sFlipVInit[16] = { + 1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, 1, 0, + 0, 1, 0, 1, +}; + +static const Matrix4 sFlipV(sFlipVInit); + //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -183,11 +192,15 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState, Matrix4 croppedTexTransform(texTransform); if (!srcRect.isEmpty()) { - croppedTexTransform.loadTranslate(srcRect.left / sourceTexture.width(), + // We flipV to convert to 0,0 top-left for the srcRect + // coordinates then flip back to 0,0 bottom-left for + // GLES coordinates. + croppedTexTransform.multiply(sFlipV); + croppedTexTransform.translate(srcRect.left / sourceTexture.width(), srcRect.top / sourceTexture.height(), 0); croppedTexTransform.scale(srcRect.getWidth() / sourceTexture.width(), srcRect.getHeight() / sourceTexture.height(), 1); - croppedTexTransform.multiply(texTransform); + croppedTexTransform.multiply(sFlipV); } Glop glop; GlopBuilder(renderState, caches, &glop) |