OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTessellatingPathRenderer.h" | 8 #include "GrTessellatingPathRenderer.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 1385 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
1386 SkRect pathBounds = fPath.getBounds(); | 1386 SkRect pathBounds = fPath.getBounds(); |
1387 Comparator c; | 1387 Comparator c; |
1388 if (pathBounds.width() > pathBounds.height()) { | 1388 if (pathBounds.width() > pathBounds.height()) { |
1389 c.sweep_lt = sweep_lt_horiz; | 1389 c.sweep_lt = sweep_lt_horiz; |
1390 c.sweep_gt = sweep_gt_horiz; | 1390 c.sweep_gt = sweep_gt_horiz; |
1391 } else { | 1391 } else { |
1392 c.sweep_lt = sweep_lt_vert; | 1392 c.sweep_lt = sweep_lt_vert; |
1393 c.sweep_gt = sweep_gt_vert; | 1393 c.sweep_gt = sweep_gt_vert; |
1394 } | 1394 } |
1395 SkScalar tol = GrPathUtils::scaleToleranceToSrc(SK_Scalar1, fViewMatrix,
pathBounds); | 1395 SkScalar screenSpaceTol = GrPathUtils::kDefaultTolerance; |
| 1396 SkScalar tol = GrPathUtils::scaleToleranceToSrc(screenSpaceTol, fViewMat
rix, pathBounds); |
1396 int contourCnt; | 1397 int contourCnt; |
1397 int maxPts = GrPathUtils::worstCasePointCount(fPath, &contourCnt, tol); | 1398 int maxPts = GrPathUtils::worstCasePointCount(fPath, &contourCnt, tol); |
1398 if (maxPts <= 0) { | 1399 if (maxPts <= 0) { |
1399 return; | 1400 return; |
1400 } | 1401 } |
1401 if (maxPts > ((int)SK_MaxU16 + 1)) { | 1402 if (maxPts > ((int)SK_MaxU16 + 1)) { |
1402 SkDebugf("Path not rendered, too many verts (%d)\n", maxPts); | 1403 SkDebugf("Path not rendered, too many verts (%d)\n", maxPts); |
1403 return; | 1404 return; |
1404 } | 1405 } |
1405 SkPath::FillType fillType = fPath.getFillType(); | 1406 SkPath::FillType fillType = fPath.getFillType(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 SkMatrix vmi; | 1512 SkMatrix vmi; |
1512 if (!viewM.invert(&vmi)) { | 1513 if (!viewM.invert(&vmi)) { |
1513 return false; | 1514 return false; |
1514 } | 1515 } |
1515 vmi.mapRect(&clipBounds); | 1516 vmi.mapRect(&clipBounds); |
1516 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); | 1517 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); |
1517 target->drawBatch(pipelineBuilder, batch); | 1518 target->drawBatch(pipelineBuilder, batch); |
1518 | 1519 |
1519 return true; | 1520 return true; |
1520 } | 1521 } |
OLD | NEW |