| 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 "GrDrawPathBatch.h" | 8 #include "GrDrawPathBatch.h" |
| 9 | 9 |
| 10 SkString GrDrawPathBatch::dumpInfo() const { | 10 SkString GrDrawPathBatch::dumpInfo() const { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Double check that it is in fact winding. | 49 // Double check that it is in fact winding. |
| 50 SkASSERT(kIncClamp_StencilOp == this->stencilSettings().passOp(pathFace)
); | 50 SkASSERT(kIncClamp_StencilOp == this->stencilSettings().passOp(pathFace)
); |
| 51 SkASSERT(kIncClamp_StencilOp == this->stencilSettings().failOp(pathFace)
); | 51 SkASSERT(kIncClamp_StencilOp == this->stencilSettings().failOp(pathFace)
); |
| 52 SkASSERT(0x1 != this->stencilSettings().writeMask(pathFace)); | 52 SkASSERT(0x1 != this->stencilSettings().writeMask(pathFace)); |
| 53 SkASSERT(!this->stencilSettings().isTwoSided()); | 53 SkASSERT(!this->stencilSettings().isTwoSided()); |
| 54 } | 54 } |
| 55 return isWinding; | 55 return isWinding; |
| 56 } | 56 } |
| 57 | 57 |
| 58 GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkM
atrix& localMatrix, | 58 GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkM
atrix& localMatrix, |
| 59 GrColor color, GrPathRange* range, Gr
PathRangeDraw* draw) | 59 GrColor color, GrPathRange* range, Gr
PathRangeDraw* draw, |
| 60 const SkRect& bounds) |
| 60 : INHERITED(ClassID(), viewMatrix, color) | 61 : INHERITED(ClassID(), viewMatrix, color) |
| 61 , fPathRange(range) | 62 , fPathRange(range) |
| 62 , fLocalMatrix(localMatrix) { | 63 , fLocalMatrix(localMatrix) { |
| 63 SkDEBUGCODE(draw->fUsedInBatch = true;) | 64 SkDEBUGCODE(draw->fUsedInBatch = true;) |
| 64 fDraws.addToHead(SkRef(draw)); | 65 fDraws.addToHead(SkRef(draw)); |
| 65 fTotalPathCount = draw->count(); | 66 fTotalPathCount = draw->count(); |
| 66 // Don't compute a bounding box. For dst copy texture, we'll opt instead for
it to just copy | 67 fBounds = bounds; |
| 67 // the entire dst. Realistically this is a moot point, because any context t
hat supports | |
| 68 // NV_path_rendering will also support NV_blend_equation_advanced. | |
| 69 // For clipping we'll just skip any optimizations based on the bounds. | |
| 70 fBounds.setLargest(); | |
| 71 } | 68 } |
| 72 | 69 |
| 73 bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { | 70 bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { |
| 74 GrDrawPathRangeBatch* that = t->cast<GrDrawPathRangeBatch>(); | 71 GrDrawPathRangeBatch* that = t->cast<GrDrawPathRangeBatch>(); |
| 75 if (this->fPathRange.get() != that->fPathRange.get()) { | 72 if (this->fPathRange.get() != that->fPathRange.get()) { |
| 76 return false; | 73 return false; |
| 77 } | 74 } |
| 78 if (!GrPathRangeDraw::CanMerge(**this->fDraws.head(), **that->fDraws.head())
) { | 75 if (!GrPathRangeDraw::CanMerge(**this->fDraws.head(), **that->fDraws.head())
) { |
| 79 return false; | 76 return false; |
| 80 } | 77 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 memcpy(indices, (*iter.get())->indices(), cnt * sizeof(uint16_t)); | 134 memcpy(indices, (*iter.get())->indices(), cnt * sizeof(uint16_t)); |
| 138 indices += cnt; | 135 indices += cnt; |
| 139 memcpy(transforms, (*iter.get())->transforms(), cnt * floatsPerTransform
* sizeof(float)); | 136 memcpy(transforms, (*iter.get())->transforms(), cnt * floatsPerTransform
* sizeof(float)); |
| 140 transforms += cnt * floatsPerTransform; | 137 transforms += cnt * floatsPerTransform; |
| 141 } | 138 } |
| 142 SkASSERT(indices - indexStorage.get() == fTotalPathCount); | 139 SkASSERT(indices - indexStorage.get() == fTotalPathCount); |
| 143 state->gpu()->pathRendering()->drawPaths(args, fPathRange.get(), indexStorag
e.get(), | 140 state->gpu()->pathRendering()->drawPaths(args, fPathRange.get(), indexStorag
e.get(), |
| 144 GrPathRange::kU16_PathIndexType, transformStorage.get(), transformType, | 141 GrPathRange::kU16_PathIndexType, transformStorage.get(), transformType, |
| 145 fTotalPathCount); | 142 fTotalPathCount); |
| 146 } | 143 } |
| OLD | NEW |