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 | 9c80b5f | 2015-08-13 10:05:51 -0700 | [diff] [blame] | 12 | #include "GrBWFillRectBatch.h" |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 13 | #include "GrColor.h" |
| 14 | |
| 15 | class GrBatch; |
| 16 | class SkMatrix; |
| 17 | struct SkRect; |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 18 | class SkStrokeRec; |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 19 | |
| 20 | /* |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 21 | * A factory for returning batches which can draw rectangles. |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 22 | */ |
| 23 | namespace GrRectBatchFactory { |
| 24 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 25 | inline GrDrawBatch* CreateFillBW(GrColor color, |
joshualitt | 0d4bcea | 2015-08-17 06:59:36 -0700 | [diff] [blame^] | 26 | const SkMatrix& viewMatrix, |
| 27 | const SkRect& rect, |
| 28 | const SkRect* localRect, |
| 29 | const SkMatrix* localMatrix) { |
joshualitt | 9c80b5f | 2015-08-13 10:05:51 -0700 | [diff] [blame] | 30 | return GrBWFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix); |
| 31 | } |
joshualitt | 7fc2a26 | 2015-08-10 10:30:14 -0700 | [diff] [blame] | 32 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 33 | inline GrDrawBatch* CreateFillAA(GrColor color, |
| 34 | const SkMatrix& viewMatrix, |
| 35 | const SkRect& rect, |
| 36 | const SkRect& devRect) { |
joshualitt | 37eb184 | 2015-08-12 06:36:57 -0700 | [diff] [blame] | 37 | return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect); |
| 38 | } |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 39 | |
joshualitt | 0d4bcea | 2015-08-17 06:59:36 -0700 | [diff] [blame^] | 40 | inline GrDrawBatch* CreateFillAA(GrColor color, |
| 41 | const SkMatrix& viewMatrix, |
| 42 | const SkMatrix& localMatrix, |
| 43 | const SkRect& rect, |
| 44 | const SkRect& devRect) { |
| 45 | return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRect); |
| 46 | } |
| 47 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 48 | GrDrawBatch* CreateStrokeBW(GrColor color, |
| 49 | const SkMatrix& viewMatrix, |
| 50 | const SkRect& rect, |
| 51 | SkScalar strokeWidth, |
| 52 | bool snapToPixelCenters); |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 53 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 54 | GrDrawBatch* CreateStrokeAA(GrColor, |
| 55 | const SkMatrix& viewMatrix, |
| 56 | const SkRect& rect, |
| 57 | const SkRect& devRect, |
| 58 | const SkStrokeRec& stroke); |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 59 | |
| 60 | // First rect is outer; second rect is inner |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame] | 61 | GrDrawBatch* CreateFillNestedRectsAA(GrColor, |
| 62 | const SkMatrix& viewMatrix, |
| 63 | const SkRect rects[2]); |
joshualitt | 14205b1 | 2015-08-10 11:40:56 -0700 | [diff] [blame] | 64 | |
joshualitt | ecd1a69 | 2015-08-10 10:08:26 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | #endif |