Don't apply filter in readback, when there is no scaling

Fix check for scaling in SkiaOpenGLReadback: old code was not
taking into account that matrix rotation swaps width/height.

Test: Passed PixelCopyTest#testWindowProducerCopyToRGBA16F
Bug: 110097060
Change-Id: I0d26416fa72a026bc376417773d5a73548b1f1a5
This commit is contained in:
Stan Iliev
2018-06-22 17:33:43 -04:00
parent bcae0ff7a2
commit d50edd004b

View File

@@ -26,6 +26,7 @@
#include "DeviceInfo.h"
#include "Matrix.h"
#include "Properties.h"
#include "utils/MathUtils.h"
using namespace android::uirenderer::renderthread;
@@ -116,9 +117,9 @@ CopyResult SkiaOpenGLReadback::copyImageInto(EGLImageKHR eglImage, const Matrix4
paint.setBlendMode(SkBlendMode::kSrc);
// Apply a filter, which is matching OpenGL pipeline readback behaviour. Filter usage
// is codified by tests using golden images like DecodeAccuracyTest.
if (skiaSrcRect.width() != bitmap->width() ||
skiaSrcRect.height() != bitmap->height()) {
// TODO: apply filter always, but check if tests will be fine
bool disableFilter = MathUtils::areEqual(skiaSrcRect.width(), skiaDestRect.width())
&& MathUtils::areEqual(skiaSrcRect.height(), skiaDestRect.height());
if (!disableFilter) {
paint.setFilterQuality(kLow_SkFilterQuality);
}
scaledSurface->getCanvas()->concat(textureMatrix);