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

Commit 7cda7637 authored by John Reck's avatar John Reck Committed by Automerger Merge Worker
Browse files

Merge "CTS of CtsMediaTestCases#android.media.cts.DecodeAccuracyTest may fail...

Merge "CTS of CtsMediaTestCases#android.media.cts.DecodeAccuracyTest may fail when video is cropped. When we use GPU to copy the data, rendering would choose filter. But we need add shrink in border to ensure the sampler not reach border like what GUI does." am: 06e16941 am: 44bfae17 am: b0838b91 am: ab55cd0a am: 9a38d4f4

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1801770

Change-Id: I598a9da169a6157bf6bb69a546a445cd9f6de626
parents 8193a03b 9a38d4f4
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@

using namespace android::uirenderer::renderthread;

static constexpr bool sEnableExtraCropInset = true;

namespace android {
namespace uirenderer {

@@ -64,6 +66,20 @@ CopyResult Readback::copySurfaceInto(ANativeWindow* window, const Rect& inSrcRec
        ALOGW("Surface doesn't have any previously queued frames, nothing to readback from");
        return CopyResult::SourceEmpty;
    }

    if (sEnableExtraCropInset &&
        (cropRect.right - cropRect.left != bitmap->width() ||
        cropRect.bottom - cropRect.top != bitmap->height())) {
       /*
        * When we need use filtering, we should also make border shrink here like gui.
        * But we could not check format for YUV or RGB here... Just use 1 pix.
        */
        cropRect.left += 0.5f;
        cropRect.top  += 0.5f;
        cropRect.right -= 0.5f;
        cropRect.bottom -= 0.5f;
    }

    UniqueAHardwareBuffer sourceBuffer{rawSourceBuffer};
    AHardwareBuffer_Desc description;
    AHardwareBuffer_describe(sourceBuffer.get(), &description);