| Index: src/gpu/GrOptDrawState.cpp
|
| diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
|
| index 010fe4b7392fb2444a8e4ad2c4f4d91f004dee6f..9ebe551d6bc5d5fa141f94854ca75e17ebf17daf 100644
|
| --- a/src/gpu/GrOptDrawState.cpp
|
| +++ b/src/gpu/GrOptDrawState.cpp
|
| @@ -14,36 +14,21 @@
|
| #include "GrXferProcessor.h"
|
|
|
| GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
|
| - const GrGeometryProcessor* gp,
|
| - const GrPathProcessor* pathProc,
|
| + GrColor color,
|
| + uint8_t coverage,
|
| const GrDrawTargetCaps& caps,
|
| const ScissorState& scissorState,
|
| const GrDeviceCoordTexture* dstCopy,
|
| GrGpu::DrawType drawType)
|
| : fFinalized(false) {
|
| + GrColor coverageColor = GrColorPackRGBA(coverage, coverage, coverage, coverage);
|
| fDrawType = drawType;
|
|
|
| - // 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);
|
| + const GrProcOptInfo& colorPOI = drawState.colorProcInfo(color);
|
| + const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(coverageColor);
|
|
|
| fColor = colorPOI.inputColorToEffectiveStage();
|
| - // TODO fix this when coverage stages work correctly
|
| - // fCoverage = coveragePOI.inputColorToEffectiveStage();
|
| - fCoverage = fPrimitiveProcessor->coverage();
|
| + fCoverage = coverage;
|
|
|
| // Create XferProcessor from DS's XPFactory
|
| SkAutoTUnref<GrXferProcessor> xferProcessor(
|
| @@ -101,11 +86,14 @@
|
| fFlags |= kDither_Flag;
|
| }
|
|
|
| - fDescInfo.fHasVertexColor = gp && gp->hasVertexColor();
|
| -
|
| - fDescInfo.fHasVertexCoverage = gp && gp->hasVertexCoverage();
|
| -
|
| - bool hasLocalCoords = gp && gp->hasLocalCoords();
|
| + fDescInfo.fHasVertexColor = drawState.hasGeometryProcessor() &&
|
| + drawState.getGeometryProcessor()->hasVertexColor();
|
| +
|
| + fDescInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() &&
|
| + drawState.getGeometryProcessor()->hasVertexCoverage();
|
| +
|
| + bool hasLocalCoords = drawState.hasGeometryProcessor() &&
|
| + drawState.getGeometryProcessor()->hasLocalCoords();
|
|
|
| int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
|
| fDescInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed();
|
| @@ -117,6 +105,7 @@
|
| // drawState's coverageProcInfo (like color above) to set this initial information.
|
| int firstCoverageStageIdx = 0;
|
| fDescInfo.fInputCoverageIsUsed = true;
|
| +
|
|
|
| GrXferProcessor::BlendInfo blendInfo;
|
| fXferProcessor->getBlendInfo(&blendInfo);
|
| @@ -129,6 +118,12 @@
|
|
|
| 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,
|
| @@ -144,7 +139,7 @@
|
| }
|
|
|
| // let the GP init the batch tracker
|
| - if (gp) {
|
| + if (drawState.hasGeometryProcessor()) {
|
| GrGeometryProcessor::InitBT init;
|
| init.fOutputColor = fDescInfo.fInputColorIsUsed;
|
| init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed;
|
|
|