aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGr.cpp
diff options
context:
space:
mode:
authorGravatar sugoi <sugoi@chromium.org>2015-03-06 05:16:52 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-06 05:16:52 -0800
commit4ab3dbb636d07d03df1190c8a2b0a730e30e0d29 (patch)
treeac3dae56208e9bec344333e4dd87a1d35c87907c /src/gpu/SkGr.cpp
parent55f0b18ee079b1517f43c08c70f91e1a21928d23 (diff)
Adding linear interpolation to rgb->yuv conversion
When the UV planes are smaller than the Y plane, doing the upscaling in nearest mode was creating artefacts, so I changed it to use linear interpolation to fix the issue. BUG=460380 Committed: https://skia.googlesource.com/skia/+/cd9d42c5167a50f1bf20e969343556d61354171b Review URL: https://codereview.chromium.org/973563002
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r--src/gpu/SkGr.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index ff6f7fa098..d105418377 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -365,8 +365,12 @@ static GrTexture* load_yuv_texture(GrContext* ctx, const GrUniqueKey& optionalKe
for (int i = 0; i < 3; ++i) {
yuvDesc.fWidth = yuvInfo.fSize[i].fWidth;
yuvDesc.fHeight = yuvInfo.fSize[i].fHeight;
- yuvTextures[i].reset(
- ctx->refScratchTexture(yuvDesc, GrContext::kApprox_ScratchTexMatch));
+ bool needsExactTexture =
+ (yuvDesc.fWidth != yuvInfo.fSize[0].fWidth) ||
+ (yuvDesc.fHeight != yuvInfo.fSize[0].fHeight);
+ yuvTextures[i].reset(ctx->refScratchTexture(yuvDesc,
+ needsExactTexture ? GrContext::kExact_ScratchTexMatch :
+ GrContext::kApprox_ScratchTexMatch));
if (!yuvTextures[i] ||
!yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight,
yuvDesc.fConfig, planes[i], yuvInfo.fRowBytes[i])) {