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 "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 for (int i = 0; i < instanceCount; i++) { | 283 for (int i = 0; i < instanceCount; i++) { |
284 Geometry& args = fGeoData[i]; | 284 Geometry& args = fGeoData[i]; |
285 | 285 |
286 int contourCount; | 286 int contourCount; |
287 maxVertices += GrPathUtils::worstCasePointCount(args.fPath, &contour
Count, | 287 maxVertices += GrPathUtils::worstCasePointCount(args.fPath, &contour
Count, |
288 args.fTolerance); | 288 args.fTolerance); |
289 | 289 |
290 isIndexed = isIndexed || contourCount > 1; | 290 isIndexed = isIndexed || contourCount > 1; |
291 } | 291 } |
292 | 292 |
| 293 if (maxVertices == 0 || maxVertices > ((int)SK_MaxU16 + 1)) { |
| 294 SkDebugf("Cannot render path (%d)\n", maxVertices); |
| 295 return; |
| 296 } |
| 297 |
293 // determine primitiveType | 298 // determine primitiveType |
294 int maxIndices = 0; | 299 int maxIndices = 0; |
295 GrPrimitiveType primitiveType; | 300 GrPrimitiveType primitiveType; |
296 if (this->isHairline()) { | 301 if (this->isHairline()) { |
297 if (isIndexed) { | 302 if (isIndexed) { |
298 maxIndices = 2 * maxVertices; | 303 maxIndices = 2 * maxVertices; |
299 primitiveType = kLines_GrPrimitiveType; | 304 primitiveType = kLines_GrPrimitiveType; |
300 } else { | 305 } else { |
301 primitiveType = kLineStrip_GrPrimitiveType; | 306 primitiveType = kLineStrip_GrPrimitiveType; |
302 } | 307 } |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 731 |
727 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 732 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
728 GrPipelineBuilder* pipelineBuilder, | 733 GrPipelineBuilder* pipelineBuilder, |
729 const SkMatrix& viewMatrix, | 734 const SkMatrix& viewMatrix, |
730 const SkPath& path, | 735 const SkPath& path, |
731 const SkStrokeRec& stroke) { | 736 const SkStrokeRec& stroke) { |
732 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 737 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
733 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 738 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
734 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); | 739 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); |
735 } | 740 } |
OLD | NEW |