diff options
-rwxr-xr-x | src/gpu/GrBitmapTextContext.cpp | 2 | ||||
-rwxr-xr-x | src/gpu/GrDistanceFieldTextContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrDrawState.h | 44 | ||||
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.cpp | 10 |
4 files changed, 10 insertions, 48 deletions
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp index 3ca98e46eb..b2cea2b024 100755 --- a/src/gpu/GrBitmapTextContext.cpp +++ b/src/gpu/GrBitmapTextContext.cpp @@ -138,10 +138,8 @@ void GrBitmapTextContext::flushGlyphs() { case kA8_GrMaskFormat: // set back to normal in case we took LCD path previously. drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlendCoeff()); - //drawState->setColor(fPaint.getColor()); // We're using per-vertex color. SkASSERT(drawState->hasColorVertexAttribute()); - drawState->setColor(0xFFFFFFFF); break; default: SkFAIL("Unexepected mask format."); diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp index 003ed4075f..4321ff17ef 100755 --- a/src/gpu/GrDistanceFieldTextContext.cpp +++ b/src/gpu/GrDistanceFieldTextContext.cpp @@ -218,10 +218,8 @@ void GrDistanceFieldTextContext::flushGlyphs() { } else { // set back to normal in case we took LCD path previously. drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlendCoeff()); - //drawState->setColor(fPaint.getColor()); // We're using per-vertex color. SkASSERT(drawState->hasColorVertexAttribute()); - drawState->setColor(0xFFFFFFFF); } int nGlyphs = fCurrVertex / 4; fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer()); diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h index a4db89d643..90bdc64507 100644 --- a/src/gpu/GrDrawState.h +++ b/src/gpu/GrDrawState.h @@ -267,38 +267,6 @@ public: this->setColor((a << 24) | (a << 16) | (a << 8) | a); } - /** - * Constructor sets the color to be 'color' which is undone by the destructor. - */ - class AutoColorRestore : public ::SkNoncopyable { - public: - AutoColorRestore() : fDrawState(NULL), fOldColor(0) {} - - AutoColorRestore(GrDrawState* drawState, GrColor color) { - fDrawState = NULL; - this->set(drawState, color); - } - - void reset() { - if (NULL != fDrawState) { - fDrawState->setColor(fOldColor); - fDrawState = NULL; - } - } - - void set(GrDrawState* drawState, GrColor color) { - this->reset(); - fDrawState = drawState; - fOldColor = fDrawState->getColor(); - fDrawState->setColor(color); - } - - ~AutoColorRestore() { this->reset(); } - private: - GrDrawState* fDrawState; - GrColor fOldColor; - }; - /// @} /////////////////////////////////////////////////////////////////////////// @@ -893,10 +861,14 @@ public: if draws can be batched. The return value indicates whether combining is possible and, if so, which of the two inputs should be used. */ static CombinedState CombineIfPossible(const GrDrawState& a, const GrDrawState& b) { + bool usingVertexColors = a.hasColorVertexAttribute(); + if (!usingVertexColors && a.fColor != b.fColor) { + return kIncompatible_CombinedState; + } + if (a.fRenderTarget.get() != b.fRenderTarget.get() || a.fColorStages.count() != b.fColorStages.count() || a.fCoverageStages.count() != b.fCoverageStages.count() || - a.fColor != b.fColor || !a.fViewMatrix.cheapEqualTo(b.fViewMatrix) || a.fSrcBlend != b.fSrcBlend || a.fDstBlend != b.fDstBlend || @@ -905,11 +877,15 @@ public: a.fVACount != b.fVACount || memcmp(a.fVAPtr, b.fVAPtr, a.fVACount * sizeof(GrVertexAttrib)) || a.fStencilSettings != b.fStencilSettings || - a.fCoverage != b.fCoverage || a.fDrawFace != b.fDrawFace) { return kIncompatible_CombinedState; } + bool usingVertexCoverage = a.hasCoverageVertexAttribute(); + if (!usingVertexCoverage && a.fCoverage != b.fCoverage) { + return kIncompatible_CombinedState; + } + bool explicitLocalCoords = a.hasLocalCoordAttribute(); for (int i = 0; i < a.fColorStages.count(); i++) { if (!GrEffectStage::AreCompatible(a.fColorStages[i], b.fColorStages[i], diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 6e447590b0..954437c933 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -139,8 +139,6 @@ static bool cmd_has_trace_marker(uint8_t cmd) { void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, const SkRect* localRect, const SkMatrix* localMatrix) { - GrDrawState::AutoColorRestore acr; - GrDrawState* drawState = this->drawState(); GrColor color = drawState->getColor(); @@ -150,14 +148,6 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, this->caps()->dualSourceBlendingSupport() || drawState->hasSolidCoverage(), NULL != localRect, &colorOffset, &localOffset); - if (colorOffset >= 0) { - // We set the draw state's color to white here. This is done so that any batching performed - // in our subclass's onDraw() won't get a false from GrDrawState::op== due to a color - // mismatch. TODO: Once vertex layout is owned by GrDrawState it should skip comparing the - // constant color in its op== when the kColor layout bit is set and then we can remove - // this. - acr.set(drawState, 0xFFFFFFFF); - } AutoReleaseGeometry geo(this, 4, 0); if (!geo.succeeded()) { |