| Index: src/gpu/GrInOrderDrawBuffer.cpp
|
| diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
|
| index 493420db0b1d111448f078383cf249918f3b02c9..520d5b0eb92d71ae3e383d09939b0170570f2619 100644
|
| --- a/src/gpu/GrInOrderDrawBuffer.cpp
|
| +++ b/src/gpu/GrInOrderDrawBuffer.cpp
|
| @@ -62,14 +62,17 @@ void get_vertex_bounds(const void* vertices,
|
|
|
| The vertex attrib order is always pos, color, [local coords].
|
| */
|
| -static void set_vertex_attributes(GrDrawState* drawState, bool hasLocalCoords, GrColor color) {
|
| +static const GrGeometryProcessor* create_rect_gp(GrDrawState* drawState,
|
| + bool hasLocalCoords,
|
| + GrColor color) {
|
| uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
|
| GrDefaultGeoProcFactory::kColor_GPType;
|
| flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
|
| - drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color, flags))->unref();
|
| + const GrGeometryProcessor* gp = GrDefaultGeoProcFactory::Create(color, flags);
|
| if (0xFF == GrColorUnpackA(color)) {
|
| drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
|
| }
|
| + return gp;
|
| }
|
|
|
| static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettings) {
|
| @@ -116,9 +119,10 @@ void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
|
| const SkMatrix* localMatrix) {
|
| GrDrawState::AutoRestoreEffects are(ds);
|
|
|
| - set_vertex_attributes(ds, SkToBool(localRect), color);
|
| + SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(ds, SkToBool(localRect),
|
| + color));
|
|
|
| - size_t vstride = ds->getGeometryProcessor()->getVertexStride();
|
| + size_t vstride = gp->getVertexStride();
|
| SkASSERT(vstride == sizeof(SkPoint) + sizeof(GrColor) + (SkToBool(localRect) ? sizeof(SkPoint) :
|
| 0));
|
| AutoReleaseGeometry geo(this, 4, vstride, 0);
|
| @@ -165,7 +169,7 @@ void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
|
| }
|
|
|
| this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer());
|
| - this->drawIndexedInstances(ds, kTriangles_GrPrimitiveType, 1, 4, 6, &devBounds);
|
| + this->drawIndexedInstances(ds, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &devBounds);
|
| }
|
|
|
| int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawInfo& info) {
|
| @@ -221,13 +225,13 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawIn
|
| }
|
|
|
| void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
|
| + const GrGeometryProcessor* gp,
|
| const DrawInfo& info,
|
| const ScissorState& scissorState,
|
| const GrDeviceCoordTexture* dstCopy) {
|
| SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer()));
|
|
|
| - const GrGeometryProcessor* gp = ds.getGeometryProcessor();
|
| - if (!this->recordStateAndShouldDraw(ds, gp->getColor(), gp->getCoverage(),
|
| + if (!this->recordStateAndShouldDraw(ds, gp, NULL,
|
| GrGpu::PrimTypeToDrawType(info.primitiveType()),
|
| scissorState, dstCopy)) {
|
| return;
|
| @@ -249,11 +253,12 @@ void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
|
| }
|
|
|
| void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds,
|
| + const GrPathProcessor* pp,
|
| const GrPath* path,
|
| const GrClipMaskManager::ScissorState& scissorState,
|
| const GrStencilSettings& stencilSettings) {
|
| // Only compare the subset of GrDrawState relevant to path stenciling?
|
| - if (!this->recordStateAndShouldDraw(ds, GrColor_WHITE, 0xff, GrGpu::kStencilPath_DrawType,
|
| + if (!this->recordStateAndShouldDraw(ds, NULL, pp, GrGpu::kStencilPath_DrawType,
|
| scissorState, NULL)) {
|
| return;
|
| }
|
| @@ -263,14 +268,14 @@ void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds,
|
| }
|
|
|
| void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds,
|
| - GrColor color,
|
| + const GrPathProcessor* pp,
|
| const GrPath* path,
|
| const GrClipMaskManager::ScissorState& scissorState,
|
| const GrStencilSettings& stencilSettings,
|
| const GrDeviceCoordTexture* dstCopy) {
|
| // TODO: Only compare the subset of GrDrawState relevant to path covering?
|
| - if (!this->recordStateAndShouldDraw(ds, color, 0xff, GrGpu::kDrawPath_DrawType, scissorState,
|
| - dstCopy)) {
|
| + if (!this->recordStateAndShouldDraw(ds, NULL, pp, GrGpu::kDrawPath_DrawType,
|
| + scissorState, dstCopy)) {
|
| return;
|
| }
|
| DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path));
|
| @@ -279,7 +284,7 @@ void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds,
|
| }
|
|
|
| void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
|
| - GrColor color,
|
| + const GrPathProcessor* pp,
|
| const GrPathRange* pathRange,
|
| const void* indices,
|
| PathIndexType indexType,
|
| @@ -293,7 +298,7 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
|
| SkASSERT(indices);
|
| SkASSERT(transformValues);
|
|
|
| - if (!this->recordStateAndShouldDraw(ds, color, 0xff, GrGpu::kDrawPath_DrawType, scissorState,
|
| + if (!this->recordStateAndShouldDraw(ds, NULL, pp, GrGpu::kDrawPath_DrawType, scissorState,
|
| dstCopy)) {
|
| return;
|
| }
|
| @@ -324,7 +329,7 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
|
| transformType == previous->fTransformType &&
|
| stencilSettings == previous->fStencilSettings &&
|
| path_fill_type_is_winding(stencilSettings) &&
|
| - !ds.willBlendWithDst(color, GrColor_WHITE)) {
|
| + !ds.willBlendWithDst(pp)) {
|
| // Fold this DrawPaths call into the one previous.
|
| previous->fCount += count;
|
| return;
|
| @@ -490,14 +495,14 @@ bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst,
|
| }
|
|
|
| bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds,
|
| - GrColor color,
|
| - uint8_t coverage,
|
| + const GrGeometryProcessor* gp,
|
| + const GrPathProcessor* pp,
|
| GrGpu::DrawType drawType,
|
| const GrClipMaskManager::ScissorState& scissor,
|
| const GrDeviceCoordTexture* dstCopy) {
|
| SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState,
|
| - (ds, color, coverage, *this->getGpu()->caps(), scissor,
|
| - dstCopy, drawType));
|
| + (ds, gp, pp, *this->getGpu()->caps(), scissor, dstCopy,
|
| + drawType));
|
| if (ss->fState.mustSkip()) {
|
| fCmdBuffer.pop_back();
|
| return false;
|
|
|