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

Unified Diff: src/gpu/GrDefaultPathRenderer.cpp

Issue 825443002: Add conic support to Default and AAConvex path redender. (Closed) Base URL: https://skia.googlesource.com/skia.git@conics
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
Index: src/gpu/GrDefaultPathRenderer.cpp
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index d8f723eaefdc0fc33b0c1e5cef664fb5acacb14f..aaa40ecb1a6cfa46d432b85b04bfc7d03181fccc 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -11,6 +11,7 @@
#include "GrDefaultGeoProcFactory.h"
#include "GrDrawState.h"
#include "GrPathUtils.h"
+#include "SkGeometry.h"
#include "SkString.h"
#include "SkStrokeRec.h"
#include "SkTLazy.h"
@@ -256,9 +257,27 @@ bool GrDefaultPathRenderer::createGeom(GrDrawTarget* target,
for (;;) {
SkPath::Verb verb = iter.next(pts);
switch (verb) {
- case SkPath::kConic_Verb:
- SkASSERT(0);
+ case SkPath::kConic_Verb: {
+ SkScalar weight = iter.conicWeight();
+ SkAutoConicToQuads converter;
+ const SkPoint* quadPts = converter.computeQuads(pts, weight, 0.25f);
reed1 2014/12/22 20:04:09 // Converting in src-space, hence the finer tolera
egdaniel 2014/12/22 21:37:13 Done.
+ for (int i = 0; i < converter.countQuads(); ++i) {
+ int baseIdx = i*2;
+ uint16_t firstQPtIdx = (uint16_t)(vert - base) - 1;
reed1 2014/12/22 20:04:09 Separate from this CL: WHAT THE HECK IS UP WITH IN
egdaniel 2014/12/22 21:37:13 Brian do you have any insight on this?
bsalomon 2014/12/22 22:10:31 I dunno... the indices have to fit in shorts, but
+ uint16_t numPts = (uint16_t)
+ GrPathUtils::generateQuadraticPoints(
+ quadPts[baseIdx], quadPts[baseIdx + 1], quadPts[baseIdx + 2],
+ srcSpaceTolSqd, &vert,
+ GrPathUtils::quadraticPointCount(quadPts + baseIdx, srcSpaceTol));
+ if (indexed) {
+ for (uint16_t i = 0; i < numPts; ++i) {
+ append_countour_edge_indices(isHairline, subpathIdxStart,
+ firstQPtIdx + i, &idx);
+ }
+ }
+ }
break;
+ }
case SkPath::kMove_Verb:
if (!first) {
uint16_t currIdx = (uint16_t) (vert - base);
@@ -526,10 +545,8 @@ bool GrDefaultPathRenderer::canDrawPath(const GrDrawTarget* target,
const SkStrokeRec& stroke,
bool antiAlias) const {
// this class can draw any path with any fill but doesn't do any anti-aliasing.
-
- return !antiAlias && !(SkPath::kConic_SegmentMask & path.getSegmentMasks()) &&
- (stroke.isFillStyle() ||
- IsStrokeHairlineOrEquivalent(stroke, drawState->getViewMatrix(), NULL));
+ return !antiAlias && (stroke.isFillStyle() ||
+ IsStrokeHairlineOrEquivalent(stroke, drawState->getViewMatrix(), NULL));
}
bool GrDefaultPathRenderer::onDrawPath(GrDrawTarget* target,

Powered by Google App Engine
This is Rietveld 408576698