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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user