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

Unified Diff: src/gpu/GrDefaultPathRenderer.cpp

Issue 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: bug 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/GrDefaultPathRenderer.h ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDefaultPathRenderer.cpp
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 4d9026f08606e6470e4440f92ddead91a17972a8..24d3c456cb34edaa5edf03a4e50027194ebacf1e 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -233,12 +233,10 @@ bool GrDefaultPathRenderer::createGeom(GrDrawTarget* target,
}
}
- // TODO this is really wierd, I just need default vertex stride, can I think of a better way?
- SkAutoTUnref<const GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Create());
- if (!arg->set(target, maxPts, gp->getVertexStride(), maxIdxs)) {
+ if (!arg->set(target, maxPts, GrDefaultGeoProcFactory::DefaultVertexStride(), maxIdxs)) {
return false;
}
- SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
+ SkASSERT(GrDefaultGeoProcFactory::DefaultVertexStride() == sizeof(SkPoint));
uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices());
uint16_t* idx = idxBase;
@@ -330,6 +328,7 @@ FINISHED:
bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
GrDrawState* drawState,
+ GrColor color,
const SkPath& path,
const SkStrokeRec& origStroke,
bool stencilOnly) {
@@ -337,10 +336,10 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
SkTCopyOnFirstWrite<SkStrokeRec> stroke(origStroke);
SkScalar hairlineCoverage;
+ uint8_t newCoverage = 0xff;
if (IsStrokeHairlineOrEquivalent(*stroke, drawState->getViewMatrix(),
&hairlineCoverage)) {
- uint8_t newCoverage = SkScalarRoundToInt(hairlineCoverage * drawState->getCoverage());
- drawState->setCoverage(newCoverage);
+ newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff);
if (!stroke->isHairlineStyle()) {
stroke.writable()->setHairlineStyle();
@@ -493,13 +492,16 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
bounds = path.getBounds();
}
GrDrawTarget::AutoGeometryPush agp(target);
- target->drawSimpleRect(drawState, bounds);
+ target->drawSimpleRect(drawState, color, bounds);
} else {
if (passCount > 1) {
drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
}
GrDrawState::AutoRestoreEffects are(drawState);
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create())->unref();
+ drawState->setGeometryProcessor(
+ GrDefaultGeoProcFactory::Create(color,
+ GrDefaultGeoProcFactory::kPosition_GPType,
+ newCoverage))->unref();
if (indexCnt) {
target->drawIndexed(drawState,
primType,
@@ -530,11 +532,13 @@ bool GrDefaultPathRenderer::canDrawPath(const GrDrawTarget* target,
bool GrDefaultPathRenderer::onDrawPath(GrDrawTarget* target,
GrDrawState* drawState,
+ GrColor color,
const SkPath& path,
const SkStrokeRec& stroke,
bool antiAlias) {
return this->internalDrawPath(target,
drawState,
+ color,
path,
stroke,
false);
@@ -546,5 +550,5 @@ void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
const SkStrokeRec& stroke) {
SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
- this->internalDrawPath(target, drawState, path, stroke, true);
+ this->internalDrawPath(target, drawState, GrColor_WHITE, path, stroke, true);
}
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.h ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698