| 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 #ifndef GrRectBatchFactory_DEFINED | 8 #ifndef GrRectBatchFactory_DEFINED |
| 9 #define GrRectBatchFactory_DEFINED | 9 #define GrRectBatchFactory_DEFINED |
| 10 | 10 |
| 11 #include "GrAAFillRectBatch.h" | 11 #include "GrAAFillRectBatch.h" |
| 12 #include "GrAAStrokeRectBatch.h" | 12 #include "GrAAStrokeRectBatch.h" |
| 13 #include "GrAnalyticRectBatch.h" |
| 13 #include "GrColor.h" | 14 #include "GrColor.h" |
| 14 #include "GrNonAAFillRectBatch.h" | 15 #include "GrNonAAFillRectBatch.h" |
| 15 #include "GrNonAAStrokeRectBatch.h" | 16 #include "GrNonAAStrokeRectBatch.h" |
| 17 #include "GrPaint.h" |
| 16 #include "SkMatrix.h" | 18 #include "SkMatrix.h" |
| 17 | 19 |
| 18 class GrBatch; | 20 class GrBatch; |
| 19 struct SkRect; | 21 struct SkRect; |
| 20 class SkStrokeRec; | 22 class SkStrokeRec; |
| 21 | 23 |
| 22 /* | 24 /* |
| 23 * A factory for returning batches which can draw rectangles. | 25 * A factory for returning batches which can draw rectangles. |
| 24 */ | 26 */ |
| 25 namespace GrRectBatchFactory { | 27 namespace GrRectBatchFactory { |
| 26 | 28 |
| 27 inline GrDrawBatch* CreateNonAAFill(GrColor color, | 29 inline GrDrawBatch* CreateNonAAFill(GrColor color, |
| 28 const SkMatrix& viewMatrix, | 30 const SkMatrix& viewMatrix, |
| 29 const SkRect& rect, | 31 const SkRect& rect, |
| 30 const SkRect* localRect, | 32 const SkRect* localRect, |
| 31 const SkMatrix* localMatrix) { | 33 const SkMatrix* localMatrix) { |
| 32 if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspecti
ve())) { | 34 if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspecti
ve())) { |
| 33 return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, re
ct, localRect, | 35 return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, re
ct, localRect, |
| 34 localMatrix); | 36 localMatrix); |
| 35 } else { | 37 } else { |
| 36 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, localRect,
localMatrix); | 38 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, localRect,
localMatrix); |
| 37 } | 39 } |
| 38 } | 40 } |
| 39 | 41 |
| 42 inline GrDrawBatch* CreateAAFill(const GrPaint& paint, |
| 43 const SkMatrix& viewMatrix, |
| 44 const SkRect& rect, |
| 45 const SkRect& croppedRect, |
| 46 const SkRect& devRect) { |
| 47 if (!paint.usesDistanceVectorField()) { |
| 48 return GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, croppedRe
ct, devRect); |
| 49 } else { |
| 50 return GrAnalyticRectBatch::CreateAnalyticRectBatch(paint.getColor(), vi
ewMatrix, rect, |
| 51 croppedRect, devRect
); |
| 52 } |
| 53 } |
| 54 |
| 40 inline GrDrawBatch* CreateAAFill(GrColor color, | 55 inline GrDrawBatch* CreateAAFill(GrColor color, |
| 41 const SkMatrix& viewMatrix, | |
| 42 const SkRect& rect, | |
| 43 const SkRect& devRect) { | |
| 44 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect); | |
| 45 } | |
| 46 | |
| 47 inline GrDrawBatch* CreateAAFill(GrColor color, | |
| 48 const SkMatrix& viewMatrix, | 56 const SkMatrix& viewMatrix, |
| 49 const SkMatrix& localMatrix, | 57 const SkMatrix& localMatrix, |
| 50 const SkRect& rect, | 58 const SkRect& rect, |
| 51 const SkRect& devRect) { | 59 const SkRect& devRect) { |
| 52 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); | 60 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); |
| 53 } | 61 } |
| 54 | 62 |
| 55 inline GrDrawBatch* CreateNonAAStroke(GrColor color, | 63 inline GrDrawBatch* CreateNonAAStroke(GrColor color, |
| 56 const SkMatrix& viewMatrix, | 64 const SkMatrix& viewMatrix, |
| 57 const SkRect& rect, | 65 const SkRect& rect, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 } | 76 } |
| 69 | 77 |
| 70 // First rect is outer; second rect is inner | 78 // First rect is outer; second rect is inner |
| 71 GrDrawBatch* CreateAAFillNestedRects(GrColor, | 79 GrDrawBatch* CreateAAFillNestedRects(GrColor, |
| 72 const SkMatrix& viewMatrix, | 80 const SkMatrix& viewMatrix, |
| 73 const SkRect rects[2]); | 81 const SkRect rects[2]); |
| 74 | 82 |
| 75 }; | 83 }; |
| 76 | 84 |
| 77 #endif | 85 #endif |
| OLD | NEW |