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

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

Issue 424103002: Add effect caching to distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase to ToT Created 6 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/GrDistanceFieldTextContext.cpp ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDistanceFieldTextureEffect.h
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.h b/src/gpu/effects/GrDistanceFieldTextureEffect.h
index 38e41e5590d6d801304cdc3d5d37a6895b8907e6..ab84753fff85642eaa2e3920a81d7716b6d0c695 100644
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.h
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.h
@@ -14,6 +14,24 @@
class GrGLDistanceFieldTextureEffect;
class GrGLDistanceFieldLCDTextureEffect;
+enum GrDistanceFieldEffectFlags {
+ kSimilarity_DistanceFieldEffectFlag = 0x01, // ctm is similarity matrix
+ kRectToRect_DistanceFieldEffectFlag = 0x02, // ctm maps rects to rects
+ kUseLCD_DistanceFieldEffectFlag = 0x04, // use lcd text
+ kBGR_DistanceFieldEffectFlag = 0x08, // lcd display has bgr order
+ kPortrait_DistanceFieldEffectFlag = 0x10, // lcd display is in portrait mode (not used yet)
+
+ kUniformScale_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag |
+ kRectToRect_DistanceFieldEffectFlag,
+ // The subset of the flags relevant to GrDistanceFieldTextureEffect
+ kNonLCD_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag,
+ // The subset of the flags relevant to GrDistanceFieldLCDTextureEffect
+ kLCD_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag |
+ kRectToRect_DistanceFieldEffectFlag |
+ kUseLCD_DistanceFieldEffectFlag |
+ kBGR_DistanceFieldEffectFlag,
+};
+
/**
* The output color of this effect is a modulation of the input color and a sample from a
* distance field texture (using a smoothed step function near 0.5).
@@ -25,14 +43,14 @@ public:
#ifdef SK_GAMMA_APPLY_TO_A8
static GrEffect* Create(GrTexture* tex, const GrTextureParams& params,
GrTexture* gamma, const GrTextureParams& gammaParams, float lum,
- bool similarity) {
+ uint32_t flags) {
return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, gamma, gammaParams, lum,
- similarity));
+ flags));
}
#else
static GrEffect* Create(GrTexture* tex, const GrTextureParams& params,
- bool similarity) {
- return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, similarity));
+ uint32_t flags) {
+ return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, flags));
}
#endif
@@ -44,7 +62,7 @@ public:
#ifdef SK_GAMMA_APPLY_TO_A8
float getLuminance() const { return fLuminance; }
#endif
- bool isSimilarity() const { return fIsSimilarity; }
+ uint32_t getFlags() const { return fFlags; }
typedef GrGLDistanceFieldTextureEffect GLEffect;
@@ -55,7 +73,7 @@ private:
#ifdef SK_GAMMA_APPLY_TO_A8
GrTexture* gamma, const GrTextureParams& gammaParams, float lum,
#endif
- bool uniformScale);
+ uint32_t flags);
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
@@ -64,7 +82,7 @@ private:
GrTextureAccess fGammaTextureAccess;
float fLuminance;
#endif
- bool fIsSimilarity;
+ uint32_t fFlags;
GR_DECLARE_EFFECT_TEST;
@@ -81,9 +99,9 @@ class GrDistanceFieldLCDTextureEffect : public GrVertexEffect {
public:
static GrEffect* Create(GrTexture* tex, const GrTextureParams& params,
GrTexture* gamma, const GrTextureParams& gammaParams,
- SkColor textColor, bool uniformScale, bool useBGR) {
+ SkColor textColor, uint32_t flags) {
return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect,
- (tex, params, gamma, gammaParams, textColor, uniformScale, useBGR));
+ (tex, params, gamma, gammaParams, textColor, flags));
}
virtual ~GrDistanceFieldLCDTextureEffect() {}
@@ -92,8 +110,7 @@ public:
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
GrColor getTextColor() const { return fTextColor; }
- bool isUniformScale() const { return fUniformScale; }
- bool useBGR() const { return fUseBGR; }
+ uint32_t getFlags() const { return fFlags; }
typedef GrGLDistanceFieldLCDTextureEffect GLEffect;
@@ -103,15 +120,14 @@ private:
GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& params,
GrTexture* gamma, const GrTextureParams& gammaParams,
SkColor textColor,
- bool uniformScale, bool useBGR);
+ uint32_t flags);
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
GrTextureAccess fTextureAccess;
GrTextureAccess fGammaTextureAccess;
GrColor fTextColor;
- bool fUniformScale;
- bool fUseBGR;
+ uint32_t fFlags;
GR_DECLARE_EFFECT_TEST;
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698