Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: src/gpu/effects/GrYUVtoRGBEffect.cpp

Issue 926123002: Revert of YUV scale fix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrYUVtoRGBEffect.cpp
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 8daf34829c20e1663b52f2fbeeb2a834ff607218..736135282c2dbc7d1a51e5703542f3c070abe83e 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -18,22 +18,8 @@
class YUVtoRGBEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture,
- GrTexture* vTexture, SkISize sizes[3],
- SkYUVColorSpace colorSpace) {
- SkScalar w[3], h[3];
- w[0] = SkIntToScalar(sizes[0].fWidth) / SkIntToScalar(yTexture->width());
- h[0] = SkIntToScalar(sizes[0].fHeight) / SkIntToScalar(yTexture->height());
- w[1] = SkIntToScalar(sizes[1].fWidth) / SkIntToScalar(uTexture->width());
- h[1] = SkIntToScalar(sizes[1].fHeight) / SkIntToScalar(uTexture->height());
- w[2] = SkIntToScalar(sizes[2].fWidth) / SkIntToScalar(vTexture->width());
- h[2] = SkIntToScalar(sizes[2].fHeight) / SkIntToScalar(vTexture->height());
- SkMatrix yuvMatrix[3];
- yuvMatrix[0] = GrCoordTransform::MakeDivByTextureWHMatrix(yTexture);
- yuvMatrix[1] = yuvMatrix[0];
- yuvMatrix[1].preScale(w[1] / w[0], h[1] / h[0]);
- yuvMatrix[2] = yuvMatrix[0];
- yuvMatrix[2].preScale(w[2] / w[0], h[2] / h[0]);
- return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, yuvMatrix, colorSpace));
+ GrTexture* vTexture, SkYUVColorSpace colorSpace) {
+ return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, colorSpace));
}
const char* name() const SK_OVERRIDE { return "YUV to RGB"; }
@@ -67,9 +53,9 @@
fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", outputColor);
fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0].getType());
fsBuilder->codeAppend(".r,\n\t\t");
- fsBuilder->appendTextureLookup(samplers[1], coords[1].c_str(), coords[1].getType());
+ fsBuilder->appendTextureLookup(samplers[1], coords[0].c_str(), coords[0].getType());
fsBuilder->codeAppend(".r,\n\t\t");
- fsBuilder->appendTextureLookup(samplers[2], coords[2].c_str(), coords[2].getType());
+ fsBuilder->appendTextureLookup(samplers[2], coords[0].c_str(), coords[0].getType());
fsBuilder->codeAppendf(".r,\n\t\t1.0) * %s;\n", yuvMatrix);
}
@@ -103,20 +89,18 @@
private:
YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
- SkMatrix yuvMatrix[3], SkYUVColorSpace colorSpace)
- : fYTransform(kLocal_GrCoordSet, yuvMatrix[0], yTexture, GrTextureParams::kNone_FilterMode)
+ SkYUVColorSpace colorSpace)
+ : fCoordTransform(kLocal_GrCoordSet,
+ GrCoordTransform::MakeDivByTextureWHMatrix(yTexture),
+ yTexture, GrTextureParams::kNone_FilterMode)
, fYAccess(yTexture)
- , fUTransform(kLocal_GrCoordSet, yuvMatrix[1], uTexture, GrTextureParams::kNone_FilterMode)
, fUAccess(uTexture)
- , fVTransform(kLocal_GrCoordSet, yuvMatrix[2], vTexture, GrTextureParams::kNone_FilterMode)
, fVAccess(vTexture)
, fColorSpace(colorSpace) {
this->initClassID<YUVtoRGBEffect>();
- this->addCoordTransform(&fYTransform);
+ this->addCoordTransform(&fCoordTransform);
this->addTextureAccess(&fYAccess);
- this->addCoordTransform(&fUTransform);
this->addTextureAccess(&fUAccess);
- this->addCoordTransform(&fVTransform);
this->addTextureAccess(&fVAccess);
}
@@ -131,11 +115,9 @@
GrInvariantOutput::kWillNot_ReadInput);
}
- GrCoordTransform fYTransform;
+ GrCoordTransform fCoordTransform;
GrTextureAccess fYAccess;
- GrCoordTransform fUTransform;
GrTextureAccess fUAccess;
- GrCoordTransform fVTransform;
GrTextureAccess fVAccess;
SkYUVColorSpace fColorSpace;
@@ -158,7 +140,6 @@
GrFragmentProcessor*
GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
- SkISize sizes[3], SkYUVColorSpace colorSpace) {
- SkASSERT(yTexture && uTexture && vTexture && sizes);
- return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, sizes, colorSpace);
+ SkYUVColorSpace colorSpace) {
+ return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace);
}
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698