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

Unified Diff: src/gpu/GrAAHairLinePathRenderer.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/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAARectRenderer.h » ('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 15a5569b3072c73c05471af3d7a0486042ce89f7..37150bd9a592317cffba51c34199a8900d326f95 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -643,6 +643,7 @@ void add_line(const SkPoint p[2],
bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target,
GrDrawState* drawState,
+ uint8_t coverage,
GrDrawTarget::AutoReleaseGeometry* arg,
SkRect* devBounds,
const SkPath& path,
@@ -670,7 +671,7 @@ bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target,
}
devBounds->set(lines.begin(), lines.count());
for (int i = 0; i < lineCnt; ++i) {
- add_line(&lines[2*i], toSrc, drawState->getCoverage(), &verts);
+ add_line(&lines[2*i], toSrc, coverage, &verts);
}
// All the verts computed by add_line are within sqrt(1^2 + 0.5^2) of the end points.
static const SkScalar kSqrtOfOneAndAQuarter = 1.118f;
@@ -803,14 +804,15 @@ bool check_bounds(GrDrawState* drawState, const SkRect& devBounds, void* vertice
bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
GrDrawState* drawState,
+ GrColor color,
const SkPath& path,
const SkStrokeRec& stroke,
bool antiAlias) {
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);
}
SkIRect devClipBounds;
@@ -837,10 +839,13 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
uint32_t gpFlags = GrDefaultGeoProcFactory::kPosition_GPType |
GrDefaultGeoProcFactory::kCoverage_GPType;
GrDrawState::AutoRestoreEffects are(drawState);
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(gpFlags))->unref();
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color,
+ gpFlags,
+ newCoverage))->unref();
if (!this->createLineGeom(target,
drawState,
+ newCoverage,
&arg,
&devBounds,
path,
@@ -911,7 +916,10 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
if (quadCnt > 0) {
GrGeometryProcessor* hairQuadProcessor =
- GrQuadEffect::Create(kHairlineAA_GrProcessorEdgeType, *target->caps());
+ GrQuadEffect::Create(color,
+ kHairlineAA_GrProcessorEdgeType,
+ *target->caps(),
+ newCoverage);
SkASSERT(hairQuadProcessor);
GrDrawState::AutoRestoreEffects are(drawState);
target->setIndexSourceToBuffer(fQuadsIndexBuffer);
@@ -934,7 +942,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
if (conicCnt > 0) {
GrDrawState::AutoRestoreEffects are(drawState);
GrGeometryProcessor* hairConicProcessor = GrConicEffect::Create(
- kHairlineAA_GrProcessorEdgeType, *target->caps());
+ color, kHairlineAA_GrProcessorEdgeType, *target->caps(), newCoverage);
SkASSERT(hairConicProcessor);
drawState->setGeometryProcessor(hairConicProcessor)->unref();
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAARectRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698