Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index 96594b1d63d1ae1141029b5a19dd37619e05859c..adb7128e1c5118d9d6a428185d943c8710c2c0ec 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -307,7 +307,6 @@ |
//////////////////////////////////////////////////////////////////////////////// |
bool GrDrawTarget::checkDraw(const GrDrawState& drawState, |
- const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int startVertex, |
int startIndex, |
@@ -350,7 +349,8 @@ |
SkASSERT(drawState.getRenderTarget()); |
- if (gp) { |
+ if (drawState.hasGeometryProcessor()) { |
+ const GrGeometryProcessor* gp = drawState.getGeometryProcessor(); |
int numTextures = gp->numTextures(); |
for (int t = 0; t < numTextures; ++t) { |
GrTexture* texture = gp->texture(t); |
@@ -383,10 +383,12 @@ |
} |
bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds, |
- const GrPrimitiveProcessor* primProc, |
+ GrColor color, |
+ uint8_t coverage, |
GrDeviceCoordTexture* dstCopy, |
const SkRect* drawBounds) { |
- if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor(primProc)) { |
+ GrColor c = GrColorPackRGBA(coverage, coverage, coverage, coverage); |
+ if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor(color, c)) { |
return true; |
} |
SkIRect copyRect; |
@@ -434,7 +436,6 @@ |
} |
void GrDrawTarget::drawIndexed(GrDrawState* ds, |
- const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int startVertex, |
int startIndex, |
@@ -443,7 +444,7 @@ |
const SkRect* devBounds) { |
SkASSERT(ds); |
if (indexCount > 0 && |
- this->checkDraw(*ds, gp, type, startVertex, startIndex, vertexCount, indexCount)) { |
+ this->checkDraw(*ds, type, startVertex, startIndex, vertexCount, indexCount)) { |
// Setup clip |
GrClipMaskManager::ScissorState scissorState; |
@@ -470,23 +471,24 @@ |
// TODO: We should continue with incorrect blending. |
GrDeviceCoordTexture dstCopy; |
- if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy, devBounds)) { |
+ const GrGeometryProcessor* gp = ds->getGeometryProcessor(); |
+ if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage(), &dstCopy, |
+ devBounds)) { |
return; |
} |
this->setDrawBuffers(&info, gp->getVertexStride()); |
- this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
+ this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
} |
} |
void GrDrawTarget::drawNonIndexed(GrDrawState* ds, |
- const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int startVertex, |
int vertexCount, |
const SkRect* devBounds) { |
SkASSERT(ds); |
- if (vertexCount > 0 && this->checkDraw(*ds, gp, type, startVertex, -1, vertexCount, -1)) { |
+ if (vertexCount > 0 && this->checkDraw(*ds, type, startVertex, -1, vertexCount, -1)) { |
// Setup clip |
GrClipMaskManager::ScissorState scissorState; |
@@ -513,13 +515,15 @@ |
// TODO: We should continue with incorrect blending. |
GrDeviceCoordTexture dstCopy; |
- if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy, devBounds)) { |
+ const GrGeometryProcessor* gp = ds->getGeometryProcessor(); |
+ if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage(), &dstCopy, |
+ devBounds)) { |
return; |
} |
this->setDrawBuffers(&info, gp->getVertexStride()); |
- this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
+ this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
} |
} |
@@ -559,7 +563,6 @@ |
} |
void GrDrawTarget::stencilPath(GrDrawState* ds, |
- const GrPathProcessor* pathProc, |
const GrPath* path, |
GrPathRendering::FillType fill) { |
// TODO: extract portions of checkDraw that are relevant to path stenciling. |
@@ -581,11 +584,11 @@ |
ds->getRenderTarget()->getStencilBuffer(), |
&stencilSettings); |
- this->onStencilPath(*ds, pathProc, path, scissorState, stencilSettings); |
+ this->onStencilPath(*ds, path, scissorState, stencilSettings); |
} |
void GrDrawTarget::drawPath(GrDrawState* ds, |
- const GrPathProcessor* pathProc, |
+ GrColor color, |
const GrPath* path, |
GrPathRendering::FillType fill) { |
// TODO: extract portions of checkDraw that are relevant to path rendering. |
@@ -612,16 +615,16 @@ |
&stencilSettings); |
GrDeviceCoordTexture dstCopy; |
- if (!this->setupDstReadIfNecessary(ds, pathProc, &dstCopy, &devBounds)) { |
+ if (!this->setupDstReadIfNecessary(ds, color, 0xff, &dstCopy, &devBounds)) { |
return; |
} |
- this->onDrawPath(*ds, pathProc, path, scissorState, stencilSettings, dstCopy.texture() ? &dstCopy : |
- NULL); |
+ this->onDrawPath(*ds, color, path, scissorState, stencilSettings, dstCopy.texture() ? &dstCopy : |
+ NULL); |
} |
void GrDrawTarget::drawPaths(GrDrawState* ds, |
- const GrPathProcessor* pathProc, |
+ GrColor color, |
const GrPathRange* pathRange, |
const void* indices, |
PathIndexType indexType, |
@@ -656,11 +659,11 @@ |
// point, because any context that supports NV_path_rendering will also |
// support NV_blend_equation_advanced. |
GrDeviceCoordTexture dstCopy; |
- if (!this->setupDstReadIfNecessary(ds, pathProc, &dstCopy, NULL)) { |
+ if (!this->setupDstReadIfNecessary(ds, color, 0xff, &dstCopy, NULL)) { |
return; |
} |
- this->onDrawPaths(*ds, pathProc, pathRange, indices, indexType, transformValues, transformType, |
+ this->onDrawPaths(*ds, color, pathRange, indices, indexType, transformValues, transformType, |
count, scissorState, stencilSettings, dstCopy.texture() ? &dstCopy : NULL); |
} |
@@ -730,7 +733,6 @@ |
//////////////////////////////////////////////////////////////////////////////// |
void GrDrawTarget::drawIndexedInstances(GrDrawState* ds, |
- const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int instanceCount, |
int verticesPerInstance, |
@@ -769,7 +771,8 @@ |
// TODO: We should continue with incorrect blending. |
GrDeviceCoordTexture dstCopy; |
- if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy,devBounds)) { |
+ const GrGeometryProcessor* gp = ds->getGeometryProcessor(); |
+ if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage(), &dstCopy,devBounds)) { |
return; |
} |
@@ -779,14 +782,13 @@ |
info.fIndexCount = info.fInstanceCount * indicesPerInstance; |
if (this->checkDraw(*ds, |
- gp, |
type, |
info.fStartVertex, |
info.fStartIndex, |
info.fVertexCount, |
info.fIndexCount)) { |
this->setDrawBuffers(&info, gp->getVertexStride()); |
- this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
+ this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
} |
info.fStartVertex += info.fVertexCount; |
instanceCount -= info.fInstanceCount; |