Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82000f7e authored by Stan Iliev's avatar Stan Iliev Committed by Po-Chien Hsueh
Browse files

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
Bug: 111776948
Change-Id: I0d26416fa72a026bc376417773d5a73548b1f1a5
Merged-In: I0d26416fa72a026bc376417773d5a73548b1f1a5
(cherry picked from commit d50edd00)
(cherry picked from commit ee7b63aa646c937e326ac5f39f07f724020533bb)
(cherry picked from commit cccd0385)
parent d4f5a0ad
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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);