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

Unified Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 794843002: Revert of Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: 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 a95f9003666b9cea0729b7515b7adb21393e4ae2..37150bd9a592317cffba51c34199a8900d326f95 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -644,7 +644,6 @@
bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target,
GrDrawState* drawState,
uint8_t coverage,
- size_t vertexStride,
GrDrawTarget::AutoReleaseGeometry* arg,
SkRect* devBounds,
const SkPath& path,
@@ -654,8 +653,9 @@
int vertCnt = kLineSegNumVertices * lineCnt;
- SkASSERT(vertexStride == sizeof(LineVertex));
- if (!arg->set(target, vertCnt, vertexStride, 0)) {
+ size_t vstride = drawState->getGeometryProcessor()->getVertexStride();
+ SkASSERT(vstride == sizeof(LineVertex));
+ if (!arg->set(target, vertCnt, vstride, 0)) {
return false;
}
@@ -839,14 +839,13 @@
uint32_t gpFlags = GrDefaultGeoProcFactory::kPosition_GPType |
GrDefaultGeoProcFactory::kCoverage_GPType;
GrDrawState::AutoRestoreEffects are(drawState);
- SkAutoTUnref<const GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Create(color,
- gpFlags,
- newCoverage));
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color,
+ gpFlags,
+ newCoverage))->unref();
if (!this->createLineGeom(target,
drawState,
newCoverage,
- gp->getVertexStride(),
&arg,
&devBounds,
path,
@@ -872,7 +871,6 @@
while (lines < lineCnt) {
int n = SkTMin(lineCnt - lines, kLineSegsNumInIdxBuffer);
target->drawIndexed(drawState,
- gp,
kTriangles_GrPrimitiveType,
kLineSegNumVertices*lines, // startV
0, // startI
@@ -917,20 +915,20 @@
kQuadNumVertices * quadCnt + kQuadNumVertices * conicCnt));
if (quadCnt > 0) {
- SkAutoTUnref<GrGeometryProcessor> hairQuadProcessor(
+ 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
@@ -943,16 +941,15 @@
if (conicCnt > 0) {
GrDrawState::AutoRestoreEffects are(drawState);
- SkAutoTUnref<GrGeometryProcessor> hairConicProcessor(
- GrConicEffect::Create(color, kHairlineAA_GrProcessorEdgeType, *target->caps(),
- newCoverage));
+ 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