diff options
author | John Reck <jreck@google.com> | 2021-10-04 16:31:29 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-10-04 16:31:29 +0000 |
commit | 06e16941d5902abe9dd8fa854e18ebfa99c9d3ab (patch) | |
tree | 89db8f9105bebcca4c479008bcefd87f6c13298f | |
parent | b0578d5fa3812b1032786f412d865aa7c46a2255 (diff) | |
parent | b48d4d10abfd1af41d8226939f12b6af5e243dff (diff) | |
download | base-06e16941d5902abe9dd8fa854e18ebfa99c9d3ab.tar.gz |
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."
-rw-r--r-- | libs/hwui/Readback.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/hwui/Readback.cpp b/libs/hwui/Readback.cpp index e08b99d52cdb..d897e94f969f 100644 --- a/libs/hwui/Readback.cpp +++ b/libs/hwui/Readback.cpp @@ -32,6 +32,8 @@ using namespace android::uirenderer::renderthread; +static constexpr bool sEnableExtraCropInset = true; + namespace android { namespace uirenderer { @@ -71,6 +73,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); |