OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
11 #include "GrDrawState.h" | 11 #include "GrDrawState.h" |
12 #include "GrPathUtils.h" | 12 #include "GrPathUtils.h" |
13 #include "SkString.h" | 13 #include "SkString.h" |
14 #include "SkStrokeRec.h" | 14 #include "SkStrokeRec.h" |
15 #include "SkTLazy.h" | 15 #include "SkTLazy.h" |
16 #include "SkTrace.h" | 16 #include "SkTraceEvent.h" |
17 | 17 |
18 | 18 |
19 GrDefaultPathRenderer::GrDefaultPathRenderer(bool separateStencilSupport, | 19 GrDefaultPathRenderer::GrDefaultPathRenderer(bool separateStencilSupport, |
20 bool stencilWrapOpsSupport) | 20 bool stencilWrapOpsSupport) |
21 : fSeparateStencil(separateStencilSupport) | 21 : fSeparateStencil(separateStencilSupport) |
22 , fStencilWrapOps(stencilWrapOpsSupport) { | 22 , fStencilWrapOps(stencilWrapOpsSupport) { |
23 } | 23 } |
24 | 24 |
25 | 25 |
26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 bool GrDefaultPathRenderer::createGeom(const SkPath& path, | 190 bool GrDefaultPathRenderer::createGeom(const SkPath& path, |
191 const SkStrokeRec& stroke, | 191 const SkStrokeRec& stroke, |
192 SkScalar srcSpaceTol, | 192 SkScalar srcSpaceTol, |
193 GrDrawTarget* target, | 193 GrDrawTarget* target, |
194 GrPrimitiveType* primType, | 194 GrPrimitiveType* primType, |
195 int* vertexCnt, | 195 int* vertexCnt, |
196 int* indexCnt, | 196 int* indexCnt, |
197 GrDrawTarget::AutoReleaseGeometry* arg) { | 197 GrDrawTarget::AutoReleaseGeometry* arg) { |
198 { | 198 { |
199 SK_TRACE_EVENT0("GrDefaultPathRenderer::createGeom"); | |
200 | |
201 SkScalar srcSpaceTolSqd = SkScalarMul(srcSpaceTol, srcSpaceTol); | 199 SkScalar srcSpaceTolSqd = SkScalarMul(srcSpaceTol, srcSpaceTol); |
202 int contourCnt; | 200 int contourCnt; |
203 int maxPts = GrPathUtils::worstCasePointCount(path, &contourCnt, | 201 int maxPts = GrPathUtils::worstCasePointCount(path, &contourCnt, |
204 srcSpaceTol); | 202 srcSpaceTol); |
205 | 203 |
206 if (maxPts <= 0) { | 204 if (maxPts <= 0) { |
207 return false; | 205 return false; |
208 } | 206 } |
209 if (maxPts > ((int)SK_MaxU16 + 1)) { | 207 if (maxPts > ((int)SK_MaxU16 + 1)) { |
210 GrPrintf("Path not rendered, too many verts (%d)\n", maxPts); | 208 GrPrintf("Path not rendered, too many verts (%d)\n", maxPts); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 false); | 528 false); |
531 } | 529 } |
532 | 530 |
533 void GrDefaultPathRenderer::onStencilPath(const SkPath& path, | 531 void GrDefaultPathRenderer::onStencilPath(const SkPath& path, |
534 const SkStrokeRec& stroke, | 532 const SkStrokeRec& stroke, |
535 GrDrawTarget* target) { | 533 GrDrawTarget* target) { |
536 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 534 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
537 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 535 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
538 this->internalDrawPath(path, stroke, target, true); | 536 this->internalDrawPath(path, stroke, target, true); |
539 } | 537 } |
OLD | NEW |