summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kazuhiro Inaba <kinaba@google.com> 2020-03-11 00:01:53 +0900
committer Kazuhiro Inaba <kinaba@google.com> 2020-03-11 00:01:53 +0900
commita74d637df14aed6b767828f0cdd19f139013db7f (patch)
treef9cd7a49496301244431e78032f99d24b9e79535
parent82f3ed2925a9520e160165fdb39e0601400b453c (diff)
Let LayerDrawable choose the best scaling filter for readback.
The check used in Readback.cpp did not take the transformation matrix into account for judging whether the copy was scaling. libs/hwui/pipeline/skia/LayerDrawable.cpp already incorporates the logic to detect non-scaling copy, so we can just let it check the condition. This version regards 90-degree rotation without size change as non-scaling and disables filters. Bug: 151126720 Bug: 150839078 Test: atest android.view.cts.PixelCopyTest Change-Id: I69e987e6a2e48299c5e579f8c218c42a724dc606
-rw-r--r--libs/hwui/Readback.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libs/hwui/Readback.cpp b/libs/hwui/Readback.cpp
index 84c07d7d9dff..39900e65cb8a 100644
--- a/libs/hwui/Readback.cpp
+++ b/libs/hwui/Readback.cpp
@@ -146,12 +146,11 @@ CopyResult Readback::copyImageInto(const sk_sp<SkImage>& image, Matrix4& texTran
}
Layer layer(mRenderThread.renderState(), nullptr, 255, SkBlendMode::kSrc);
- bool disableFilter = MathUtils::areEqual(skiaSrcRect.width(), skiaDestRect.width()) &&
- MathUtils::areEqual(skiaSrcRect.height(), skiaDestRect.height());
- layer.setForceFilter(!disableFilter);
layer.setSize(displayedWidth, displayedHeight);
texTransform.copyTo(layer.getTexTransform());
layer.setImage(image);
+ // Scaling filter is not explicitly set here, because it is done inside copyLayerInfo
+ // after checking the necessity based on the src/dest rect size and the transformation.
if (copyLayerInto(&layer, &skiaSrcRect, &skiaDestRect, bitmap)) {
copyResult = CopyResult::Success;
}