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

Unified Diff: src/gpu/GrDrawState.cpp

Issue 25023003: Implement color filter as GrGLEffect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase 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
Index: src/gpu/GrDrawState.cpp
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index d1d6c5813ef50d8a466de2faefe8c08945277058..ef04c8dd223192fd131f67f8c79be3e21023bd9e 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -27,17 +27,17 @@ bool GrDrawState::setIdentityViewMatrix() {
}
void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRenderTarget* rt) {
- SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numTotalStages());
+ SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->totalStageCount());
fColorStages.reset();
fCoverageStages.reset();
for (int i = 0; i < paint.numColorStages(); ++i) {
- fColorStages.push_back(paint.getColorStage(i));
+ fColorStages.appendStage(paint.getColorStage(i));
}
for (int i = 0; i < paint.numCoverageStages(); ++i) {
- fCoverageStages.push_back(paint.getCoverageStage(i));
+ fCoverageStages.appendStage(paint.getCoverageStage(i));
}
this->setRenderTarget(rt);
@@ -59,7 +59,6 @@ void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias());
this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff());
- this->setColorFilter(paint.getColorFilterColor(), paint.getColorFilterMode());
this->setCoverage(paint.getCoverage());
}
@@ -219,13 +218,6 @@ bool GrDrawState::srcAlphaWillBeOne() const {
(*effect)->getConstantColorComponents(&color, &validComponentFlags);
}
- // Check if the color filter could introduce an alpha.
- // We could skip the above work when this is true, but it is rare and the right fix is to make
- // the color filter a GrEffect and implement getConstantColorComponents() for it.
- if (SkXfermode::kDst_Mode != this->getColorFilterMode()) {
- validComponentFlags = 0;
- }
-
// Check whether coverage is treated as color. If so we run through the coverage computation.
if (this->isCoverageDrawing()) {
GrColor coverageColor = this->getCoverage();
@@ -402,9 +394,9 @@ void GrDrawState::AutoViewMatrixRestore::restore() {
if (NULL != fDrawState) {
SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;)
fDrawState->fCommon.fViewMatrix = fViewMatrix;
- SkASSERT(fDrawState->numColorStages() >= fNumColorStages);
+ SkASSERT(fDrawState->fColorStages.count() >= fNumColorStages);
int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages;
- SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages);
+ SkASSERT(fDrawState->fCoverageStages.count() >= numCoverageStages);
int i = 0;
for (int s = 0; s < fNumColorStages; ++s, ++i) {
@@ -446,7 +438,7 @@ bool GrDrawState::AutoViewMatrixRestore::setIdentity(GrDrawState* drawState) {
}
fViewMatrix = drawState->getViewMatrix();
- if (0 == drawState->numTotalStages()) {
+ if (0 == drawState->totalStageCount()) {
drawState->fCommon.fViewMatrix.reset();
fDrawState = drawState;
fNumColorStages = 0;
@@ -467,16 +459,16 @@ bool GrDrawState::AutoViewMatrixRestore::setIdentity(GrDrawState* drawState) {
}
void GrDrawState::AutoViewMatrixRestore::doEffectCoordChanges(const SkMatrix& coordChangeMatrix) {
- fSavedCoordChanges.reset(fDrawState->numTotalStages());
+ fSavedCoordChanges.reset(fDrawState->totalStageCount());
int i = 0;
- fNumColorStages = fDrawState->numColorStages();
+ fNumColorStages = fDrawState->fColorStages.count();
for (int s = 0; s < fNumColorStages; ++s, ++i) {
fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]);
fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix);
}
- int numCoverageStages = fDrawState->numCoverageStages();
+ int numCoverageStages = fDrawState->fCoverageStages.count();
for (int s = 0; s < numCoverageStages; ++s, ++i) {
fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]);
fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix);
« src/gpu/GrDrawState.h ('K') | « src/gpu/GrDrawState.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698