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

Unified Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 38573007: Do not apply hairline optimization for paths if nv_path_rendering is used (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address problems Created 7 years, 1 month 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/core/SkDrawProcs.h ('k') | src/gpu/GrContext.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 02c44191ad3bf02ec72200261fff74ce6958a76d..39563105f8e77d958cdc415be11e52e45d91b88c 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -759,7 +759,7 @@ bool GrAAHairLinePathRenderer::createLineGeom(const SkPath& path,
}
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, drawState->getCoverageColor(), &verts);
}
// All the verts computed by add_line are within sqrt(1^2 + 0.5^2) of the end points.
static const SkScalar kSqrtOfOneAndAQuarter = SkFloatToScalar(1.118f);
@@ -839,7 +839,13 @@ bool GrAAHairLinePathRenderer::canDrawPath(const SkPath& path,
const SkStrokeRec& stroke,
const GrDrawTarget* target,
bool antiAlias) const {
- if (!stroke.isHairlineStyle() || !antiAlias) {
+ if (!antiAlias) {
+ return false;
+ }
+
+ if (!IsStrokeHairlineOrEquivalent(stroke,
+ target->getDrawState().getViewMatrix(),
+ NULL)) {
return false;
}
@@ -888,12 +894,20 @@ bool check_bounds(GrDrawState* drawState, const SkRect& devBounds, void* vertice
}
bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
- const SkStrokeRec&,
+ const SkStrokeRec& stroke,
GrDrawTarget* target,
bool antiAlias) {
-
GrDrawState* drawState = target->drawState();
+ SkScalar hairlineCoverage;
+ if (IsStrokeHairlineOrEquivalent(stroke,
+ target->getDrawState().getViewMatrix(),
+ &hairlineCoverage)) {
+ uint8_t newCoverage = SkScalarRoundToInt(hairlineCoverage *
+ target->getDrawState().getCoverage());
+ target->drawState()->setCoverage(newCoverage);
+ }
+
SkIRect devClipBounds;
target->getClip()->getConservativeBounds(drawState->getRenderTarget(), &devClipBounds);
« no previous file with comments | « src/core/SkDrawProcs.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698