Index: src/gpu/GrOptDrawState.cpp |
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp |
index b4c1a60b477702f4ec30f4767760c5427635aa58..60360d21c6168d3dd8134c6e3b8eb483bb25a60e 100644 |
--- a/src/gpu/GrOptDrawState.cpp |
+++ b/src/gpu/GrOptDrawState.cpp |
@@ -14,21 +14,36 @@ |
#include "GrXferProcessor.h" |
GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
- GrColor color, |
- uint8_t coverage, |
+ const GrGeometryProcessor* gp, |
+ const GrPathProcessor* pathProc, |
const GrDrawTargetCaps& caps, |
const ScissorState& scissorState, |
const GrDeviceCoordTexture* dstCopy, |
GrGpu::DrawType drawType) |
: fFinalized(false) { |
- GrColor coverageColor = GrColorPackRGBA(coverage, coverage, coverage, coverage); |
fDrawType = drawType; |
- const GrProcOptInfo& colorPOI = drawState.colorProcInfo(color); |
- const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(coverageColor); |
+ // Copy GeometryProcesssor from DS or ODS |
+ if (gp) { |
+ SkASSERT(!pathProc); |
+ SkASSERT(!(GrGpu::IsPathRenderingDrawType(drawType) || |
+ GrGpu::kStencilPath_DrawType == drawType)); |
+ fGeometryProcessor.reset(gp); |
+ fPrimitiveProcessor.reset(gp); |
+ } else { |
+ SkASSERT(!gp && pathProc && (GrGpu::IsPathRenderingDrawType(drawType) || |
+ GrGpu::kStencilPath_DrawType == drawType)); |
+ fPrimitiveProcessor.reset(pathProc); |
+ } |
+ |
+ |
+ const GrProcOptInfo& colorPOI = drawState.colorProcInfo(fPrimitiveProcessor); |
+ const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(fPrimitiveProcessor); |
fColor = colorPOI.inputColorToEffectiveStage(); |
- fCoverage = coverage; |
+ // TODO fix this when coverage stages work correctly |
+ // fCoverage = coveragePOI.inputColorToEffectiveStage(); |
+ fCoverage = fPrimitiveProcessor->coverage(); |
// Create XferProcessor from DS's XPFactory |
SkAutoTUnref<GrXferProcessor> xferProcessor( |
@@ -83,14 +98,11 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
fFlags |= kDither_Flag; |
} |
- fDescInfo.fHasVertexColor = drawState.hasGeometryProcessor() && |
- drawState.getGeometryProcessor()->hasVertexColor(); |
+ fDescInfo.fHasVertexColor = gp && gp->hasVertexColor(); |
- fDescInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() && |
- drawState.getGeometryProcessor()->hasVertexCoverage(); |
+ fDescInfo.fHasVertexCoverage = gp && gp->hasVertexCoverage(); |
- bool hasLocalCoords = drawState.hasGeometryProcessor() && |
- drawState.getGeometryProcessor()->hasLocalCoords(); |
+ bool hasLocalCoords = gp && gp->hasLocalCoords(); |
int firstColorStageIdx = colorPOI.firstEffectiveStageIndex(); |
fDescInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed(); |
@@ -103,7 +115,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
int firstCoverageStageIdx = 0; |
fDescInfo.fInputCoverageIsUsed = true; |
- |
GrXferProcessor::BlendInfo blendInfo; |
fXferProcessor->getBlendInfo(&blendInfo); |
@@ -112,12 +123,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
fDescInfo.fRequiresLocalCoordAttrib = hasLocalCoords; |
- // Copy GeometryProcesssor from DS or ODS |
- SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) || |
- GrGpu::kStencilPath_DrawType || |
- drawState.hasGeometryProcessor()); |
- fGeometryProcessor.reset(drawState.getGeometryProcessor()); |
- |
// Copy Stages from DS to ODS |
for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { |
SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
@@ -133,7 +138,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
} |
// let the GP init the batch tracker |
- if (drawState.hasGeometryProcessor()) { |
+ if (gp) { |
GrGeometryProcessor::InitBT init; |
init.fOutputColor = fDescInfo.fInputColorIsUsed; |
init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed; |