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

Unified Diff: src/gpu/effects/GrBicubicEffect.h

Issue 2154753003: Introduce GrColorSpaceXform, for gamut conversion on textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More progress & refactoring Created 4 years, 5 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/Gr1DKernelEffect.h ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrBicubicEffect.h
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index 3c84f979191d396fb0430deac717d9c0c674675d..58bb068d5f523c60e337333df529fc86ab75377a 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -29,19 +29,23 @@ public:
const GrTextureDomain& domain() const { return fDomain; }
+ GrColorSpaceXform* colorSpaceXform() const { return fColorSpaceXform.get(); }
+
/**
* Create a simple filter effect with custom bicubic coefficients and optional domain.
*/
- static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkScalar coefficients[16],
+ static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
+ sk_sp<GrColorSpaceXform> colorSpaceXform,
+ const SkScalar coefficients[16],
const SkRect* domain = nullptr) {
if (nullptr == domain) {
static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode };
- return Make(tex, coefficients, GrCoordTransform::MakeDivByTextureWHMatrix(tex),
- kTileModes);
+ return Make(tex, std::move(colorSpaceXform), coefficients,
+ GrCoordTransform::MakeDivByTextureWHMatrix(tex), kTileModes);
} else {
return sk_sp<GrFragmentProcessor>(
- new GrBicubicEffect(tex, coefficients,
+ new GrBicubicEffect(tex, std::move(colorSpaceXform), coefficients,
GrCoordTransform::MakeDivByTextureWHMatrix(tex), *domain));
}
}
@@ -49,28 +53,35 @@ public:
/**
* Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
*/
- static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkMatrix& matrix,
+ static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
+ sk_sp<GrColorSpaceXform> colorSpaceXform,
+ const SkMatrix& matrix,
const SkShader::TileMode tileModes[2]) {
- return Make(tex, gMitchellCoefficients, matrix, tileModes);
+ return Make(tex, std::move(colorSpaceXform), gMitchellCoefficients, matrix, tileModes);
}
/**
* Create a filter effect with custom bicubic coefficients, the texture matrix, and the x/y
* tilemodes.
*/
- static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkScalar coefficients[16],
+ static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
+ sk_sp<GrColorSpaceXform> colorSpaceXform,
+ const SkScalar coefficients[16],
const SkMatrix& matrix,
const SkShader::TileMode tileModes[2]) {
- return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(tex, coefficients, matrix,
- tileModes));
+ return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(tex, std::move(colorSpaceXform),
+ coefficients, matrix, tileModes));
}
/**
* Create a Mitchell filter effect with a texture matrix and a domain.
*/
- static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, const SkMatrix& matrix,
+ static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
+ sk_sp<GrColorSpaceXform> colorSpaceXform,
+ const SkMatrix& matrix,
const SkRect& domain) {
- return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(tex, gMitchellCoefficients, matrix,
+ return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(tex, std::move(colorSpaceXform),
+ gMitchellCoefficients, matrix,
domain));
}
@@ -85,10 +96,10 @@ public:
GrTextureParams::FilterMode* filterMode);
private:
- GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], const SkMatrix &matrix,
- const SkShader::TileMode tileModes[2]);
- GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], const SkMatrix &matrix,
- const SkRect& domain);
+ GrBicubicEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkScalar coefficients[16],
+ const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
+ GrBicubicEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkScalar coefficients[16],
+ const SkMatrix &matrix, const SkRect& domain);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@@ -100,6 +111,7 @@ private:
float fCoefficients[16];
GrTextureDomain fDomain;
+ sk_sp<GrColorSpaceXform> fColorSpaceXform;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
« no previous file with comments | « src/gpu/effects/Gr1DKernelEffect.h ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698