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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 } | 1508 } |
1509 } | 1509 } |
1510 | 1510 |
1511 size_t stride = gp->getVertexStride(); | 1511 size_t stride = gp->getVertexStride(); |
1512 const GrVertexBuffer* vertexBuffer; | 1512 const GrVertexBuffer* vertexBuffer; |
1513 int firstVertex; | 1513 int firstVertex; |
1514 void* vertices = batchTarget->vertexPool()->makeSpace(stride, | 1514 void* vertices = batchTarget->vertexPool()->makeSpace(stride, |
1515 count, | 1515 count, |
1516 &vertexBuffer, | 1516 &vertexBuffer, |
1517 &firstVertex); | 1517 &firstVertex); |
| 1518 |
| 1519 if (!vertices) { |
| 1520 SkDebugf("Could not allocate vertices\n"); |
| 1521 return; |
| 1522 } |
| 1523 |
1518 LOG("emitting %d verts\n", count); | 1524 LOG("emitting %d verts\n", count); |
1519 void* end = polys_to_triangles(polys, fillType, vertices); | 1525 void* end = polys_to_triangles(polys, fillType, vertices); |
1520 int actualCount = static_cast<int>( | 1526 int actualCount = static_cast<int>( |
1521 (static_cast<char*>(end) - static_cast<char*>(vertices)) / stride); | 1527 (static_cast<char*>(end) - static_cast<char*>(vertices)) / stride); |
1522 LOG("actual count: %d\n", actualCount); | 1528 LOG("actual count: %d\n", actualCount); |
1523 SkASSERT(actualCount <= count); | 1529 SkASSERT(actualCount <= count); |
1524 | 1530 |
1525 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType | 1531 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType |
1526 : kTriangles_GrPrimitiveType; | 1532 : kTriangles_GrPrimitiveType; |
1527 GrDrawTarget::DrawInfo drawInfo; | 1533 GrDrawTarget::DrawInfo drawInfo; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 SkMatrix vmi; | 1585 SkMatrix vmi; |
1580 if (!viewM.invert(&vmi)) { | 1586 if (!viewM.invert(&vmi)) { |
1581 return false; | 1587 return false; |
1582 } | 1588 } |
1583 vmi.mapRect(&clipBounds); | 1589 vmi.mapRect(&clipBounds); |
1584 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); | 1590 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); |
1585 target->drawBatch(pipelineBuilder, batch); | 1591 target->drawBatch(pipelineBuilder, batch); |
1586 | 1592 |
1587 return true; | 1593 return true; |
1588 } | 1594 } |
OLD | NEW |