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

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

Issue 99203011: Use GrTextureDomain in GrBicubicEffect to perform non-bleeding HQ filter drawBitmap. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add initializer list for dummy rectangle to fix warnings Created 7 years 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/SkGpuDevice.cpp ('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 85bec771b4706858439a457f389abb9ddec8c0c1..cc8b1208634d76a2627f6d8c4f5946a6bb2ff7b8 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -9,6 +9,7 @@
#define GrBicubicTextureEffect_DEFINED
#include "GrSingleTextureEffect.h"
+#include "GrTextureDomain.h"
#include "GrDrawEffect.h"
#include "gl/GrGLEffect.h"
#include "GrTBackendEffectFactory.h"
@@ -31,46 +32,61 @@ public:
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- /**
- * Create a simple Mitchell filter effect.
- */
- static GrEffectRef* Create(GrTexture* tex) {
- return Create(tex, gMitchellCoefficients);
- }
+ const GrTextureDomain& domain() const { return fDomain; }
/**
- * Create a simple filter effect with custom bicubic coefficients.
+ * Create a simple filter effect with custom bicubic coefficients and optional domain.
*/
- static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) {
- const SkShader::TileMode tm[] = { SkShader::kClamp_TileMode, SkShader::kClamp_TileMode };
- return Create(tex, coefficients, MakeDivByTextureWHMatrix(tex), tm);
+ static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
+ const SkRect* domain = NULL) {
+ if (NULL == domain) {
+ static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode,
+ SkShader::kClamp_TileMode };
+ return Create(tex, coefficients, MakeDivByTextureWHMatrix(tex), kTileModes);
+ } else {
+ AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients,
+ MakeDivByTextureWHMatrix(tex),
+ *domain)));
+ return CreateEffectRef(effect);
+ }
}
/**
* Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
*/
- static GrEffectRef* Create(GrTexture* tex,
- const SkMatrix& matrix,
+ static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix,
SkShader::TileMode tileModes[2]) {
return Create(tex, gMitchellCoefficients, matrix, tileModes);
}
/**
- * The most general Create method. This allows specification of the bicubic coefficients, the
- * texture matrix, and the x/y tilemodes.
+ * Create a filter effect with custom bicubic coefficients, the texture matrix, and the x/y
+ * tilemodes.
*/
static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
- const SkMatrix& matrix,
- const SkShader::TileMode tileModes[2]) {
+ const SkMatrix& matrix, const SkShader::TileMode tileModes[2]) {
AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes)));
return CreateEffectRef(effect);
}
+ /**
+ * Create a Mitchell filter effect with a texture matrix and a domain.
+ */
+ static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix, const SkRect& domain) {
+ AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoefficients, matrix,
+ domain)));
+ return CreateEffectRef(effect);
+ }
+
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);
virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
- float fCoefficients[16];
+
+ float fCoefficients[16];
+ GrTextureDomain fDomain;
GR_DECLARE_EFFECT_TEST;
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698