summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLReadback.cpp
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2017-06-28 11:08:07 -0700
committer John Reck <jreck@google.com> 2017-06-28 18:13:19 +0000
commit7bf96a0a6f4824f2d15ec95249b8ff038fe02239 (patch)
tree2f780e805dbacbec3200cf59a04f858cae58958d /libs/hwui/OpenGLReadback.cpp
parentf36a995424b629bcd9bb1c0e65b8e572e01d0dfb (diff)
Selectively disable filtering if estimated safe
If the output matches the source rect then use GL_NEAREST instead of GL_FILTER. This is a more pixel-exact capture. Bug: 38242146 Test: CtsUiRendering & CtsViewTestCases:.PixelCopyTest passes on fugu Change-Id: I9f57a4124374568f83d45fdc8f83cc767ded888a
Diffstat (limited to 'libs/hwui/OpenGLReadback.cpp')
-rw-r--r--libs/hwui/OpenGLReadback.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/hwui/OpenGLReadback.cpp b/libs/hwui/OpenGLReadback.cpp
index c460c0d2dfd4..51927d5a2c61 100644
--- a/libs/hwui/OpenGLReadback.cpp
+++ b/libs/hwui/OpenGLReadback.cpp
@@ -191,6 +191,7 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState,
GL_TEXTURE_2D, texture, 0);
{
+ bool requiresFilter;
// Draw & readback
renderState.setViewport(destWidth, destHeight);
renderState.scissor().setEnabled(false);
@@ -208,12 +209,17 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState,
croppedTexTransform.scale(srcRect.getWidth() / sourceTexture.width(),
srcRect.getHeight() / sourceTexture.height(), 1);
croppedTexTransform.multiply(sFlipV);
+ requiresFilter = srcRect.getWidth() != (float) destWidth
+ || srcRect.getHeight() != (float) destHeight;
+ } else {
+ requiresFilter = sourceTexture.width() != (uint32_t) destWidth
+ || sourceTexture.height() != (uint32_t) destHeight;
}
Glop glop;
GlopBuilder(renderState, caches, &glop)
.setRoundRectClipState(nullptr)
.setMeshTexturedUnitQuad(nullptr)
- .setFillExternalTexture(sourceTexture, croppedTexTransform)
+ .setFillExternalTexture(sourceTexture, croppedTexTransform, requiresFilter)
.setTransform(Matrix4::identity(), TransformFlags::None)
.setModelViewMapUnitToRect(Rect(destWidth, destHeight))
.build();