Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: more windows fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAHairLinePathRenderer.cpp
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 37150bd9a592317cffba51c34199a8900d326f95..b8c44c72d57cd53ff3e6a8c6ab61175cb71dc3c8 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -644,6 +644,7 @@ void add_line(const SkPoint p[2],
bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target,
GrDrawState* drawState,
uint8_t coverage,
+ size_t vertexStride,
GrDrawTarget::AutoReleaseGeometry* arg,
SkRect* devBounds,
const SkPath& path,
@@ -653,9 +654,8 @@ bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target,
int vertCnt = kLineSegNumVertices * lineCnt;
- size_t vstride = drawState->getGeometryProcessor()->getVertexStride();
- SkASSERT(vstride == sizeof(LineVertex));
- if (!arg->set(target, vertCnt, vstride, 0)) {
+ SkASSERT(vertexStride == sizeof(LineVertex));
+ if (!arg->set(target, vertCnt, vertexStride, 0)) {
return false;
}
@@ -839,13 +839,15 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
uint32_t gpFlags = GrDefaultGeoProcFactory::kPosition_GPType |
GrDefaultGeoProcFactory::kCoverage_GPType;
GrDrawState::AutoRestoreEffects are(drawState);
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color,
- gpFlags,
- newCoverage))->unref();
+ SkAutoTUnref<const GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Create(color,
+ gpFlags,
+ false,
+ newCoverage));
if (!this->createLineGeom(target,
drawState,
newCoverage,
+ gp->getVertexStride(),
&arg,
&devBounds,
path,
@@ -871,6 +873,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
while (lines < lineCnt) {
int n = SkTMin(lineCnt - lines, kLineSegsNumInIdxBuffer);
target->drawIndexed(drawState,
+ gp,
kTriangles_GrPrimitiveType,
kLineSegNumVertices*lines, // startV
0, // startI
@@ -915,20 +918,20 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
kQuadNumVertices * quadCnt + kQuadNumVertices * conicCnt));
if (quadCnt > 0) {
- GrGeometryProcessor* hairQuadProcessor =
+ SkAutoTUnref<GrGeometryProcessor> hairQuadProcessor(
GrQuadEffect::Create(color,
kHairlineAA_GrProcessorEdgeType,
*target->caps(),
- newCoverage);
+ newCoverage));
SkASSERT(hairQuadProcessor);
GrDrawState::AutoRestoreEffects are(drawState);
target->setIndexSourceToBuffer(fQuadsIndexBuffer);
- drawState->setGeometryProcessor(hairQuadProcessor)->unref();
int quads = 0;
while (quads < quadCnt) {
int n = SkTMin(quadCnt - quads, kQuadsNumInIdxBuffer);
target->drawIndexed(drawState,
+ hairQuadProcessor,
kTriangles_GrPrimitiveType,
kQuadNumVertices*quads, // startV
0, // startI
@@ -941,15 +944,16 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
if (conicCnt > 0) {
GrDrawState::AutoRestoreEffects are(drawState);
- GrGeometryProcessor* hairConicProcessor = GrConicEffect::Create(
- color, kHairlineAA_GrProcessorEdgeType, *target->caps(), newCoverage);
+ SkAutoTUnref<GrGeometryProcessor> hairConicProcessor(
+ GrConicEffect::Create(color, kHairlineAA_GrProcessorEdgeType, *target->caps(),
+ newCoverage));
SkASSERT(hairConicProcessor);
- drawState->setGeometryProcessor(hairConicProcessor)->unref();
int conics = 0;
while (conics < conicCnt) {
int n = SkTMin(conicCnt - conics, kQuadsNumInIdxBuffer);
target->drawIndexed(drawState,
+ hairConicProcessor,
kTriangles_GrPrimitiveType,
kQuadNumVertices*(quadCnt + conics), // startV
0, // startI
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698