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

Unified Diff: src/gpu/GrAARectRenderer.cpp

Issue 761563002: First step to moving vertex attributes to the geometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adding test to ignore 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.cpp ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAARectRenderer.cpp
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index edb59d04d85361fea960930484974d0c64e9ee20..95fe8c9b7f6523dfc40074ab95787c6ac002d691 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -27,18 +27,17 @@ enum CoverageAttribType {
}
static CoverageAttribType set_rect_attribs(GrDrawState* drawState) {
+ uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType;
if (drawState->canTweakAlphaForCoverage()) {
- drawState->setGeometryProcessor(
- GrDefaultGeoProcFactory::CreateAndSetAttribs(
- drawState,
- GrDefaultGeoProcFactory::kColor_GPType))->unref();
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(flags))->unref();
+ SkASSERT(drawState->getGeometryProcessor()->getVertexStride() ==
+ sizeof(GrDefaultGeoProcFactory::PositionColorAttr));
return kUseColor_CoverageAttribType;
} else {
- drawState->setGeometryProcessor(
- GrDefaultGeoProcFactory::CreateAndSetAttribs(
- drawState,
- GrDefaultGeoProcFactory::kColor_GPType |
- GrDefaultGeoProcFactory::kCoverage_GPType))->unref();
+ flags |= GrDefaultGeoProcFactory::kCoverage_GPType;
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(flags))->unref();
+ SkASSERT(drawState->getGeometryProcessor()->getVertexStride() ==
+ sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAttr));
return kUseCoverage_CoverageAttribType;
}
}
@@ -190,7 +189,8 @@ void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
}
- GrDrawTarget::AutoReleaseGeometry geo(target, 8, drawState->getVertexStride(), 0);
+ size_t vstride = drawState->getGeometryProcessor()->getVertexStride();
+ GrDrawTarget::AutoReleaseGeometry geo(target, 8, vstride, 0);
if (!geo.succeeded()) {
SkDebugf("Failed to get space for vertices!\n");
return;
@@ -209,7 +209,6 @@ void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
}
intptr_t verts = reinterpret_cast<intptr_t>(geo.vertices());
- size_t vstride = drawState->getVertexStride();
SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vstride);
@@ -395,7 +394,8 @@ void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
int outerVertexNum = miterStroke ? 4 : 8;
int totalVertexNum = (outerVertexNum + innerVertexNum) * 2;
- GrDrawTarget::AutoReleaseGeometry geo(target, totalVertexNum, drawState->getVertexStride(), 0);
+ size_t vstride = drawState->getGeometryProcessor()->getVertexStride();
+ GrDrawTarget::AutoReleaseGeometry geo(target, totalVertexNum, vstride, 0);
if (!geo.succeeded()) {
SkDebugf("Failed to get space for vertices!\n");
return;
@@ -407,7 +407,6 @@ void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
}
intptr_t verts = reinterpret_cast<intptr_t>(geo.vertices());
- size_t vstride = drawState->getVertexStride();
// We create vertices for four nested rectangles. There are two ramps from 0 to full
// coverage, one on the exterior of the stroke and the other on the interior.
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698