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 "GrRectBatchFactory.h" | 8 #include "GrRectBatchFactory.h" |
9 | 9 |
10 #include "GrRectBatch.h" | 10 #include "GrRectBatch.h" |
| 11 #include "GrStrokeRectBatch.h" |
11 | 12 |
12 namespace GrRectBatchFactory { | 13 namespace GrRectBatchFactory { |
13 | 14 |
14 GrBatch* Create(GrColor color, | 15 GrBatch* CreateFillBW(GrColor color, |
15 const SkMatrix& viewMatrix, | 16 const SkMatrix& viewMatrix, |
16 const SkRect& rect, | 17 const SkRect& rect, |
17 const SkRect* localRect, | 18 const SkRect* localRect, |
18 const SkMatrix* localMatrix) { | 19 const SkMatrix* localMatrix) { |
19 GrRectBatch::Geometry geometry; | 20 GrRectBatch::Geometry geometry; |
20 geometry.fColor = color; | 21 geometry.fColor = color; |
21 geometry.fViewMatrix = viewMatrix; | 22 geometry.fViewMatrix = viewMatrix; |
22 geometry.fRect = rect; | 23 geometry.fRect = rect; |
23 | 24 |
24 if (localRect) { | 25 if (localRect) { |
25 geometry.fHasLocalRect = true; | 26 geometry.fHasLocalRect = true; |
26 geometry.fLocalRect = *localRect; | 27 geometry.fLocalRect = *localRect; |
27 } else { | 28 } else { |
28 geometry.fHasLocalRect = false; | 29 geometry.fHasLocalRect = false; |
29 } | 30 } |
30 | 31 |
31 if (localMatrix) { | 32 if (localMatrix) { |
32 geometry.fHasLocalMatrix = true; | 33 geometry.fHasLocalMatrix = true; |
33 geometry.fLocalMatrix = *localMatrix; | 34 geometry.fLocalMatrix = *localMatrix; |
34 } else { | 35 } else { |
35 geometry.fHasLocalMatrix = false; | 36 geometry.fHasLocalMatrix = false; |
36 } | 37 } |
37 | 38 |
38 return GrRectBatch::Create(geometry); | 39 return GrRectBatch::Create(geometry); |
39 } | 40 } |
40 | 41 |
| 42 GrBatch* CreateStrokeBW(GrColor color, |
| 43 const SkMatrix& viewMatrix, |
| 44 const SkRect& rect, |
| 45 SkScalar strokeWidth, |
| 46 bool snapToPixelCenters) { |
| 47 GrStrokeRectBatch::Geometry geometry; |
| 48 geometry.fColor = color; |
| 49 geometry.fViewMatrix = viewMatrix; |
| 50 geometry.fRect = rect; |
| 51 geometry.fStrokeWidth = strokeWidth; |
| 52 return GrStrokeRectBatch::Create(geometry, snapToPixelCenters); |
| 53 } |
| 54 |
41 }; | 55 }; |
OLD | NEW |