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 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 if (maxPts > ((int)SK_MaxU16 + 1)) { | 1402 if (maxPts > ((int)SK_MaxU16 + 1)) { |
1403 SkDebugf("Path not rendered, too many verts (%d)\n", maxPts); | 1403 SkDebugf("Path not rendered, too many verts (%d)\n", maxPts); |
1404 return; | 1404 return; |
1405 } | 1405 } |
1406 SkPath::FillType fillType = fPath.getFillType(); | 1406 SkPath::FillType fillType = fPath.getFillType(); |
1407 if (SkPath::IsInverseFillType(fillType)) { | 1407 if (SkPath::IsInverseFillType(fillType)) { |
1408 contourCnt++; | 1408 contourCnt++; |
1409 } | 1409 } |
1410 | 1410 |
1411 LOG("got %d pts, %d contours\n", maxPts, contourCnt); | 1411 LOG("got %d pts, %d contours\n", maxPts, contourCnt); |
1412 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType; | 1412 SkAutoTUnref<const GrGeometryProcessor> gp; |
1413 SkAutoTUnref<const GrGeometryProcessor> gp( | 1413 { |
1414 GrDefaultGeoProcFactory::Create(flags, fColor, fPipelineInfo.readsLo
calCoords(), | 1414 using namespace GrDefaultGeoProcFactory; |
1415 !fPipelineInfo.readsCoverage(), fVie
wMatrix, | 1415 |
1416 SkMatrix::I())); | 1416 Color color(fColor); |
| 1417 LocalCoords localCoords(fPipelineInfo.readsLocalCoords() ? |
| 1418 LocalCoords::kUsePosition_Type : |
| 1419 LocalCoords::kUnused_Type); |
| 1420 Coverage::Type coverageType; |
| 1421 if (fPipelineInfo.readsLocalCoords()) { |
| 1422 coverageType = Coverage::kNone_Type; |
| 1423 } else { |
| 1424 coverageType = Coverage::kSolid_Type; |
| 1425 } |
| 1426 Coverage coverage(coverageType); |
| 1427 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord
s, |
| 1428 fViewMatrix)); |
| 1429 } |
1417 batchTarget->initDraw(gp, pipeline); | 1430 batchTarget->initDraw(gp, pipeline); |
1418 | 1431 |
1419 SkAutoTDeleteArray<Vertex*> contours(SkNEW_ARRAY(Vertex *, contourCnt)); | 1432 SkAutoTDeleteArray<Vertex*> contours(SkNEW_ARRAY(Vertex *, contourCnt)); |
1420 | 1433 |
1421 // For the initial size of the chunk allocator, estimate based on the po
int count: | 1434 // For the initial size of the chunk allocator, estimate based on the po
int count: |
1422 // one vertex per point for the initial passes, plus two for the vertice
s in the | 1435 // one vertex per point for the initial passes, plus two for the vertice
s in the |
1423 // resulting Polys, since the same point may end up in two Polys. Assum
e minimal | 1436 // resulting Polys, since the same point may end up in two Polys. Assum
e minimal |
1424 // connectivity of one Edge per Vertex (will grow for intersections). | 1437 // connectivity of one Edge per Vertex (will grow for intersections). |
1425 SkChunkAlloc alloc(maxPts * (3 * sizeof(Vertex) + sizeof(Edge))); | 1438 SkChunkAlloc alloc(maxPts * (3 * sizeof(Vertex) + sizeof(Edge))); |
1426 path_to_contours(fPath, tol, fClipBounds, contours.get(), alloc); | 1439 path_to_contours(fPath, tol, fClipBounds, contours.get(), alloc); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 SkMatrix vmi; | 1541 SkMatrix vmi; |
1529 bool result = viewMatrix.invert(&vmi); | 1542 bool result = viewMatrix.invert(&vmi); |
1530 if (!result) { | 1543 if (!result) { |
1531 SkFAIL("Cannot invert matrix\n"); | 1544 SkFAIL("Cannot invert matrix\n"); |
1532 } | 1545 } |
1533 vmi.mapRect(&clipBounds); | 1546 vmi.mapRect(&clipBounds); |
1534 return TessellatingPathBatch::Create(color, path, viewMatrix, clipBounds); | 1547 return TessellatingPathBatch::Create(color, path, viewMatrix, clipBounds); |
1535 } | 1548 } |
1536 | 1549 |
1537 #endif | 1550 #endif |
OLD | NEW |