joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrRectBatchFactory_DEFINED |
| 9 | #define GrRectBatchFactory_DEFINED |
| 10 | |
joshualitt | 37eb184 | 2015-08-12 06:36:57 -0700 | [diff] [blame^] | 11 | #include "GrAAFillRectBatch.h" |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 12 | #include "GrColor.h" |
| 13 | |
| 14 | class GrBatch; |
| 15 | class SkMatrix; |
| 16 | struct SkRect; |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 17 | class SkStrokeRec; |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 18 | |
| 19 | /* |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 20 | * A factory for returning batches which can draw rectangles. |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 21 | */ |
| 22 | namespace GrRectBatchFactory { |
| 23 | |
joshualitt | 7fc2a26 | 2015-08-10 10:30:14 -0700 | [diff] [blame] | 24 | GrBatch* CreateFillBW(GrColor color, |
| 25 | const SkMatrix& viewMatrix, |
| 26 | const SkRect& rect, |
| 27 | const SkRect* localRect, |
| 28 | const SkMatrix* localMatrix); |
| 29 | |
joshualitt | 37eb184 | 2015-08-12 06:36:57 -0700 | [diff] [blame^] | 30 | static GrBatch* CreateFillAA(GrColor color, |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 31 | const SkMatrix& viewMatrix, |
| 32 | const SkRect& rect, |
joshualitt | 37eb184 | 2015-08-12 06:36:57 -0700 | [diff] [blame^] | 33 | const SkRect& devRect) { |
| 34 | return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect); |
| 35 | } |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 36 | |
joshualitt | 7fc2a26 | 2015-08-10 10:30:14 -0700 | [diff] [blame] | 37 | GrBatch* CreateStrokeBW(GrColor color, |
| 38 | const SkMatrix& viewMatrix, |
| 39 | const SkRect& rect, |
| 40 | SkScalar strokeWidth, |
| 41 | bool snapToPixelCenters); |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 42 | |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 43 | GrBatch* CreateStrokeAA(GrColor, |
| 44 | const SkMatrix& viewMatrix, |
| 45 | const SkRect& rect, |
| 46 | const SkRect& devRect, |
| 47 | const SkStrokeRec& stroke); |
| 48 | |
| 49 | // First rect is outer; second rect is inner |
| 50 | GrBatch* CreateFillNestedRectsAA(GrColor, |
| 51 | const SkMatrix& viewMatrix, |
| 52 | const SkRect rects[2]); |
| 53 | |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | #endif |