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 "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 polys = contours_to_polys(contours.get(), contourCnt, alloc); | 1482 polys = contours_to_polys(contours.get(), contourCnt, alloc); |
1483 SkAutoTUnref<const GrGeometryProcessor> gp( | 1483 SkAutoTUnref<const GrGeometryProcessor> gp( |
1484 GrDefaultGeoProcFactory::Create(flags, color, viewM, SkMatrix::I())); | 1484 GrDefaultGeoProcFactory::Create(flags, color, viewM, SkMatrix::I())); |
1485 int count = 0; | 1485 int count = 0; |
1486 for (Poly* poly = polys; poly; poly = poly->fNext) { | 1486 for (Poly* poly = polys; poly; poly = poly->fNext) { |
1487 if (apply_fill_type(fillType, poly->fWinding) && poly->fCount >= 3) { | 1487 if (apply_fill_type(fillType, poly->fWinding) && poly->fCount >= 3) { |
1488 count += (poly->fCount - 2) * (WIREFRAME ? 6 : 3); | 1488 count += (poly->fCount - 2) * (WIREFRAME ? 6 : 3); |
1489 } | 1489 } |
1490 } | 1490 } |
1491 | 1491 |
1492 int stride = gp->getVertexStride(); | 1492 size_t stride = gp->getVertexStride(); |
1493 GrDrawTarget::AutoReleaseGeometry arg; | 1493 GrDrawTarget::AutoReleaseGeometry arg; |
1494 if (!arg.set(target, count, stride, 0)) { | 1494 if (!arg.set(target, count, stride, 0)) { |
1495 return false; | 1495 return false; |
1496 } | 1496 } |
1497 LOG("emitting %d verts\n", count); | 1497 LOG("emitting %d verts\n", count); |
1498 void* end = polys_to_triangles(polys, fillType, arg.vertices()); | 1498 void* end = polys_to_triangles(polys, fillType, arg.vertices()); |
1499 int actualCount = (static_cast<char*>(end) - static_cast<char*>(arg.vertices
())) / stride; | 1499 int actualCount = static_cast<int>((static_cast<char*>(end) - static_cast<ch
ar*>(arg.vertices())) / stride); |
1500 LOG("actual count: %d\n", actualCount); | 1500 LOG("actual count: %d\n", actualCount); |
1501 SkASSERT(actualCount <= count); | 1501 SkASSERT(actualCount <= count); |
1502 | 1502 |
1503 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType | 1503 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType |
1504 : kTriangles_GrPrimitiveType; | 1504 : kTriangles_GrPrimitiveType; |
1505 target->drawNonIndexed(pipelineBuilder, gp, primitiveType, 0, actualCount); | 1505 target->drawNonIndexed(pipelineBuilder, gp, primitiveType, 0, actualCount); |
1506 | 1506 |
1507 return true; | 1507 return true; |
1508 } | 1508 } |
OLD | NEW |