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

Unified Diff: include/gpu/GrPaint.h

Issue 25023003: Implement color filter as GrGLEffect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review comments Created 7 years, 2 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 | « include/gpu/GrEffect.h ('k') | src/effects/SkBitmapAlphaThresholdShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrPaint.h
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 25557f9b9a4e2fdd90a4b3a8f6919013a7674186..50a32a5743a5279ae294545b25755ac1144c8c91 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -85,31 +85,13 @@ public:
bool isDither() const { return fDither; }
/**
- * Enables a SkXfermode::Mode-based color filter applied to the primitive color. The constant
- * color passed to this function is considered the "src" color and the primitive's color is
- * considered the "dst" color. Defaults to kDst_Mode which equates to simply passing through
- * the primitive color unmodified.
- */
- void setXfermodeColorFilter(SkXfermode::Mode mode, GrColor color) {
- fColorFilterColor = color;
- fColorFilterXfermode = mode;
- }
- SkXfermode::Mode getColorFilterMode() const { return fColorFilterXfermode; }
- GrColor getColorFilterColor() const { return fColorFilterColor; }
-
- /**
- * Disables the SkXfermode::Mode color filter.
- */
- void resetColorFilter() {
- fColorFilterXfermode = SkXfermode::kDst_Mode;
- fColorFilterColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff);
- }
-
- /**
* Appends an additional color effect to the color computation.
*/
const GrEffectRef* addColorEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
SkASSERT(NULL != effect);
+ if (!(*effect)->willUseInputColor()) {
+ fColorStages.reset();
+ }
SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, attr1));
return effect;
}
@@ -119,6 +101,9 @@ public:
*/
const GrEffectRef* addCoverageEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
SkASSERT(NULL != effect);
+ if (!(*effect)->willUseInputColor()) {
+ fCoverageStages.reset();
+ }
SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1));
return effect;
}
@@ -153,9 +138,6 @@ public:
fColor = paint.fColor;
fCoverage = paint.fCoverage;
- fColorFilterColor = paint.fColorFilterColor;
- fColorFilterXfermode = paint.fColorFilterXfermode;
-
fColorStages = paint.fColorStages;
fCoverageStages = paint.fCoverageStages;
@@ -171,7 +153,6 @@ public:
this->resetColor();
this->resetCoverage();
this->resetStages();
- this->resetColorFilter();
}
/**
@@ -245,9 +226,6 @@ private:
GrColor fColor;
uint8_t fCoverage;
- GrColor fColorFilterColor;
- SkXfermode::Mode fColorFilterXfermode;
-
void resetBlend() {
fSrcBlendCoeff = kOne_GrBlendCoeff;
fDstBlendCoeff = kZero_GrBlendCoeff;
« no previous file with comments | « include/gpu/GrEffect.h ('k') | src/effects/SkBitmapAlphaThresholdShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698