| 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" |
| 11 #include "GrBatchTarget.h" | 11 #include "GrBatchTarget.h" |
| 12 #include "GrBatchTest.h" |
| 12 #include "GrDefaultGeoProcFactory.h" | 13 #include "GrDefaultGeoProcFactory.h" |
| 13 #include "GrPathUtils.h" | 14 #include "GrPathUtils.h" |
| 14 #include "GrVertices.h" | 15 #include "GrVertices.h" |
| 15 #include "SkChunkAlloc.h" | 16 #include "SkChunkAlloc.h" |
| 16 #include "SkGeometry.h" | 17 #include "SkGeometry.h" |
| 17 | 18 |
| 18 #include <stdio.h> | 19 #include <stdio.h> |
| 19 | 20 |
| 20 /* | 21 /* |
| 21 * This path renderer tessellates the path into triangles, uploads the triangles
to a | 22 * This path renderer tessellates the path into triangles, uploads the triangles
to a |
| (...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 SkMatrix vmi; | 1508 SkMatrix vmi; |
| 1508 if (!viewM.invert(&vmi)) { | 1509 if (!viewM.invert(&vmi)) { |
| 1509 return false; | 1510 return false; |
| 1510 } | 1511 } |
| 1511 vmi.mapRect(&clipBounds); | 1512 vmi.mapRect(&clipBounds); |
| 1512 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); | 1513 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); |
| 1513 target->drawBatch(pipelineBuilder, batch); | 1514 target->drawBatch(pipelineBuilder, batch); |
| 1514 | 1515 |
| 1515 return true; | 1516 return true; |
| 1516 } | 1517 } |
| 1518 |
| 1519 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 1520 |
| 1521 #ifdef GR_TEST_UTILS |
| 1522 |
| 1523 BATCH_TEST_DEFINE(TesselatingPathRenderer) { |
| 1524 GrColor color = GrRandomColor(random); |
| 1525 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 1526 SkPath path = GrTest::TestPath(random); |
| 1527 SkRect clipBounds = GrTest::TestRect(random); |
| 1528 SkMatrix vmi; |
| 1529 bool result = viewMatrix.invert(&vmi); |
| 1530 if (!result) { |
| 1531 SkFAIL("Cannot invert matrix\n"); |
| 1532 } |
| 1533 vmi.mapRect(&clipBounds); |
| 1534 return TessellatingPathBatch::Create(color, path, viewMatrix, clipBounds); |
| 1535 } |
| 1536 |
| 1537 #endif |
| OLD | NEW |