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

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

Issue 219243012: Add LCD support for distance field text (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase to master Created 6 years, 9 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 212532e0a8664d765e46ac3393cb64b51d3ccaee..937908f9bc0a55fa75bcfc539596f2325b5b00c8 100644
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.h
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.h
@@ -12,6 +12,7 @@
#include "GrVertexEffect.h"
class GrGLDistanceFieldTextureEffect;
+class GrGLDistanceFieldLCDTextureEffect;
/**
* The output color of this effect is a modulation of the input color and a sample from a
@@ -21,8 +22,8 @@ class GrGLDistanceFieldTextureEffect;
*/
class GrDistanceFieldTextureEffect : public GrVertexEffect {
public:
- static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& para, bool uniformScale) {
- AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, para, uniformScale)));
+ static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& params, bool similarity) {
+ AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, similarity)));
return CreateEffectRef(effect);
}
@@ -31,7 +32,7 @@ public:
static const char* Name() { return "DistanceFieldTexture"; }
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- bool isUniformScale() const { return fUniformScale; }
+ bool isSimilarity() const { return fIsSimilarity; }
typedef GrGLDistanceFieldTextureEffect GLEffect;
@@ -44,11 +45,54 @@ private:
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
GrTextureAccess fTextureAccess;
+ bool fIsSimilarity;
+
+ GR_DECLARE_EFFECT_TEST;
+
+ typedef GrVertexEffect INHERITED;
+};
+
+/**
+ * The output color of this effect is a modulation of the input color and samples from a
+ * distance field texture (using a smoothed step function near 0.5), adjusted for LCD displays.
+ * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
+ * coords are a custom attribute.
+ */
+class GrDistanceFieldLCDTextureEffect : public GrVertexEffect {
+public:
+ static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& params,
+ bool uniformScale, bool useBGR) {
+ AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldLCDTextureEffect,
+ (tex, params, uniformScale, useBGR)));
+ return CreateEffectRef(effect);
+ }
+
+ virtual ~GrDistanceFieldLCDTextureEffect() {}
+
+ static const char* Name() { return "DistanceFieldLCDTexture"; }
+
+ virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
+ bool isUniformScale() const { return fUniformScale; }
+ bool useBGR() const { return fUseBGR; }
+
+ typedef GrGLDistanceFieldLCDTextureEffect GLEffect;
+
+ virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+
+private:
+ GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& params,
+ bool uniformScale, bool useBGR);
+
+ virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+
+ GrTextureAccess fTextureAccess;
bool fUniformScale;
+ bool fUseBGR;
GR_DECLARE_EFFECT_TEST;
typedef GrVertexEffect INHERITED;
};
+
#endif
« 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