aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Weiliang Chen <weiliangc@chromium.org>2018-05-30 15:15:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-03 21:30:27 +0000
commit3e95e578c255e8b854d7997a47b74b1b03f1346f (patch)
tree9bc84a130d3a38b54ccb585e64821bfad5cc7731 /src
parentc940f5d5ff81602b5269373a4b15dbedd09de541 (diff)
Use TextureProxy size directly in GrYUVToRGBEffect FragmentProcessor
Instead of take extra input to indicate size for texture proxies of different planes, directly use texture proxy's size. Bug: skia:7903 Change-Id: I5d6c859510f7390948c6dcfbdd17343faa786aca Reviewed-on: https://skia-review.googlesource.com/130964 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Weiliang Chen <weiliangc@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrYUVProvider.cpp2
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.cpp17
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.fp22
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.h1
-rw-r--r--src/image/SkImage_Gpu.cpp6
5 files changed, 20 insertions, 28 deletions
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 8ffc491af4..3c6c7f794c 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -124,7 +124,7 @@ sk_sp<GrTextureProxy> GrYUVProvider::refAsTextureProxy(GrContext* ctx, const GrS
GrYUVtoRGBEffect::Make(std::move(yuvTextureProxies[0]),
std::move(yuvTextureProxies[1]),
std::move(yuvTextureProxies[2]),
- yuvInfo.fSizeInfo.fSizes, yuvInfo.fColorSpace, false);
+ yuvInfo.fColorSpace, false);
paint.addColorFragmentProcessor(std::move(yuvToRgbProcessor));
// If the caller expects the pixels in a different color space than the one from the image,
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 814b69a057..55e7902739 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -27,22 +27,21 @@ std::unique_ptr<GrFragmentProcessor> GrYUVtoRGBEffect::Make(sk_sp<GrTextureProxy
uProxy,
sk_sp<GrTextureProxy>
vProxy,
- const SkISize sizes[3],
SkYUVColorSpace colorSpace,
bool nv12) {
SkScalar w[3], h[3];
- w[0] = SkIntToScalar(sizes[0].fWidth);
- h[0] = SkIntToScalar(sizes[0].fHeight);
- w[1] = SkIntToScalar(sizes[1].fWidth);
- h[1] = SkIntToScalar(sizes[1].fHeight);
- w[2] = SkIntToScalar(sizes[2].fWidth);
- h[2] = SkIntToScalar(sizes[2].fHeight);
+ w[0] = SkIntToScalar(yProxy->width());
+ h[0] = SkIntToScalar(yProxy->height());
+ w[1] = SkIntToScalar(uProxy->width());
+ h[1] = SkIntToScalar(uProxy->height());
+ w[2] = SkIntToScalar(vProxy->width());
+ h[2] = SkIntToScalar(vProxy->height());
SkMatrix yTransform = SkMatrix::I();
SkMatrix uTransform = SkMatrix::MakeScale(w[1] / w[0], h[1] / h[0]);
SkMatrix vTransform = SkMatrix::MakeScale(w[2] / w[0], h[2] / h[0]);
GrSamplerState::Filter uvFilterMode =
- ((sizes[1].fWidth != sizes[0].fWidth) || (sizes[1].fHeight != sizes[0].fHeight) ||
- (sizes[2].fWidth != sizes[0].fWidth) || (sizes[2].fHeight != sizes[0].fHeight))
+ ((uProxy->width() != yProxy->width()) || (uProxy->height() != yProxy->height()) ||
+ (vProxy->width() != yProxy->width()) || (vProxy->height() != yProxy->height()))
? GrSamplerState::Filter::kBilerp
: GrSamplerState::Filter::kNearest;
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.fp b/src/gpu/effects/GrYUVtoRGBEffect.fp
index 9b08fbd13a..e49fedae71 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.fp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.fp
@@ -40,7 +40,6 @@ layout(key) in bool nv12;
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> yProxy,
sk_sp<GrTextureProxy> uProxy,
sk_sp<GrTextureProxy> vProxy,
- const SkISize sizes[3],
SkYUVColorSpace colorSpace, bool nv12);
}
@@ -69,24 +68,23 @@ layout(key) in bool nv12;
std::unique_ptr<GrFragmentProcessor> GrYUVtoRGBEffect::Make(sk_sp<GrTextureProxy> yProxy,
sk_sp<GrTextureProxy> uProxy,
sk_sp<GrTextureProxy> vProxy,
- const SkISize sizes[3],
SkYUVColorSpace colorSpace,
bool nv12) {
SkScalar w[3], h[3];
- w[0] = SkIntToScalar(sizes[0].fWidth);
- h[0] = SkIntToScalar(sizes[0].fHeight);
- w[1] = SkIntToScalar(sizes[1].fWidth);
- h[1] = SkIntToScalar(sizes[1].fHeight);
- w[2] = SkIntToScalar(sizes[2].fWidth);
- h[2] = SkIntToScalar(sizes[2].fHeight);
+ w[0] = SkIntToScalar(yProxy->width());
+ h[0] = SkIntToScalar(yProxy->height());
+ w[1] = SkIntToScalar(uProxy->width());
+ h[1] = SkIntToScalar(uProxy->height());
+ w[2] = SkIntToScalar(vProxy->width());
+ h[2] = SkIntToScalar(vProxy->height());
SkMatrix yTransform = SkMatrix::I();
SkMatrix uTransform = SkMatrix::MakeScale(w[1] / w[0], h[1] / h[0]);
SkMatrix vTransform = SkMatrix::MakeScale(w[2] / w[0], h[2] / h[0]);
GrSamplerState::Filter uvFilterMode =
- ((sizes[1].fWidth != sizes[0].fWidth) ||
- (sizes[1].fHeight != sizes[0].fHeight) ||
- (sizes[2].fWidth != sizes[0].fWidth) ||
- (sizes[2].fHeight != sizes[0].fHeight)) ?
+ ((uProxy->width() != yProxy->width()) ||
+ (uProxy->height() != yProxy->height()) ||
+ (vProxy->width() != yProxy->width()) ||
+ (vProxy->height() != yProxy->height())) ?
GrSamplerState::Filter::kBilerp :
GrSamplerState::Filter::kNearest;
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.h b/src/gpu/effects/GrYUVtoRGBEffect.h
index 7008fbe035..3d44285bfe 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.h
+++ b/src/gpu/effects/GrYUVtoRGBEffect.h
@@ -18,7 +18,6 @@ public:
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> yProxy,
sk_sp<GrTextureProxy> uProxy,
sk_sp<GrTextureProxy> vProxy,
- const SkISize sizes[3],
SkYUVColorSpace colorSpace, bool nv12);
SkMatrix44 ySamplerTransform() const { return fYSamplerTransform; }
SkMatrix44 uSamplerTransform() const { return fUSamplerTransform; }
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 7b24858c2f..359782f745 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -439,14 +439,10 @@ sk_sp<SkImage> SkImage_Gpu::MakeFromYUVATexturesCopyImpl(GrContext* ctx,
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- // TODO: Move the sizes into GrYUVtoRGBEffect since this can just be done there.
- SkISize sizes[] = {{yProxy->width(), yProxy->height()},
- {uProxy->width(), uProxy->height()},
- {vProxy->width(), vProxy->height()}};
// TODO: Modify the fragment processor to sample from different channel instead of taking nv12
// bool.
paint.addColorFragmentProcessor(
- GrYUVtoRGBEffect::Make(yProxy, uProxy, vProxy, sizes, colorSpace, nv12));
+ GrYUVtoRGBEffect::Make(yProxy, uProxy, vProxy, colorSpace, nv12));
const SkRect rect = SkRect::MakeIWH(width, height);