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