Chromium Code Reviews| 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 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1511 SkMatrix vmi; | 1512 SkMatrix vmi; |
| 1512 if (!viewM.invert(&vmi)) { | 1513 if (!viewM.invert(&vmi)) { |
| 1513 return false; | 1514 return false; |
| 1514 } | 1515 } |
| 1515 vmi.mapRect(&clipBounds); | 1516 vmi.mapRect(&clipBounds); |
| 1516 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM , clipBounds)); | 1517 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM , clipBounds)); |
| 1517 target->drawBatch(pipelineBuilder, batch); | 1518 target->drawBatch(pipelineBuilder, batch); |
| 1518 | 1519 |
| 1519 return true; | 1520 return true; |
| 1520 } | 1521 } |
| 1522 | |
| 1523 //////////////////////////////////////////////////////////////////////////////// /////////////////// | |
| 1524 | |
| 1525 #ifdef GR_TEST_UTILS | |
| 1526 | |
| 1527 BATCH_TEST_DEFINE(TesselatingPathRenderer) { | |
| 1528 GrColor color = GrRandomColor(random); | |
| 1529 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | |
|
robertphillips
2015/05/07 16:59:29
Limit to concave paths ?
| |
| 1530 SkPath path = GrTest::TestPath(random); | |
| 1531 SkRect clipBounds = GrTest::TestRect(random); | |
| 1532 SkMatrix vmi; | |
| 1533 SkDEBUGCODE(bool result = )viewMatrix.invert(&vmi); | |
| 1534 SkASSERT(result); | |
| 1535 vmi.mapRect(&clipBounds); | |
| 1536 return TessellatingPathBatch::Create(color, path, viewMatrix, clipBounds); | |
| 1537 } | |
| 1538 | |
| 1539 #endif | |
| OLD | NEW |