Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: src/gpu/batches/GrRectBatchFactory.h

Issue 1336413006: Just an experiment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrNonAAStrokeRectBatch.h ('k') | src/gpu/draws/GrDraw.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrColor.h" 13 #include "GrColor.h"
14 #include "GrNonAAFillRectBatch.h" 14 #include "GrNonAAFillRectBatch.h"
15 #include "GrNonAAStrokeRectBatch.h" 15 #include "GrNonAAStrokeRectBatch.h"
16 #include "SkMatrix.h" 16 #include "SkMatrix.h"
17 #include "SkRect.h"
17 18
18 class GrBatch; 19 class GrBatch;
19 struct SkRect;
20 class SkStrokeRec; 20 class SkStrokeRec;
21 21
22 /* 22 /*
23 * A factory for returning batches which can draw rectangles. 23 * A factory for returning batches which can draw rectangles.
24 */ 24 */
25 namespace GrRectBatchFactory { 25 namespace GrRectBatchFactory {
26 26
27 inline GrDrawBatch* CreateNonAAFill(GrColor color, 27 inline GrDrawBatch* CreateNonAAFill(GrColor color,
28 const SkMatrix& viewMatrix, 28 const SkMatrix& viewMatrix,
29 const SkRect& rect, 29 const SkRect& rect,
30 const SkRect* localRect, 30 const SkRect* localRect,
31 const SkMatrix* localMatrix) { 31 const SkMatrix* localMatrix) {
32 if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspecti ve())) { 32 if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspecti ve())) {
33 return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, re ct, localRect, 33 return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, re ct, localRect,
34 localMatrix); 34 localMatrix);
35 } else { 35 } else {
36 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix); 36 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix);
37 } 37 }
38 } 38 }
39 39
40 inline GrDrawBatch* CreateAAFill(GrColor color, 40 inline GrDrawBatch* CreateAAFill(GrColor color,
41 const SkMatrix& viewMatrix, 41 const SkMatrix& viewMatrix,
42 const SkRect& rect) {
43
44 // map rect
45 SkRect devRect;
46 viewMatrix.mapRect(&devRect, rect);
47 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
48 }
49
50 inline GrDrawBatch* CreateAAFill(GrColor color,
51 const SkMatrix& viewMatrix,
42 const SkRect& rect, 52 const SkRect& rect,
43 const SkRect& devRect) { 53 const SkRect& devRect) {
44 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect); 54 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
45 } 55 }
46 56
47 inline GrDrawBatch* CreateAAFill(GrColor color, 57 inline GrDrawBatch* CreateAAFill(GrColor color,
48 const SkMatrix& viewMatrix, 58 const SkMatrix& viewMatrix,
49 const SkMatrix& localMatrix, 59 const SkMatrix& localMatrix,
50 const SkRect& rect, 60 const SkRect& rect) {
51 const SkRect& devRect) { 61 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect);
52 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct);
53 } 62 }
54 63
55 inline GrDrawBatch* CreateNonAAStroke(GrColor color, 64 inline GrDrawBatch* CreateNonAAStroke(GrColor color,
56 const SkMatrix& viewMatrix, 65 const SkMatrix& viewMatrix,
57 const SkRect& rect, 66 const SkRect& rect,
58 SkScalar strokeWidth, 67 SkScalar strokeWidth,
59 bool snapToPixelCenters) { 68 bool snapToPixelCenters) {
60 return GrNonAAStrokeRectBatch::Create(color, viewMatrix, rect, strokeWidth, snapToPixelCenters); 69 return GrNonAAStrokeRectBatch::Create(color, viewMatrix, rect, strokeWidth, snapToPixelCenters);
61 } 70 }
62 71
63 inline GrDrawBatch* CreateAAStroke(GrColor color, 72 inline GrDrawBatch* CreateAAStroke(GrColor color,
64 const SkMatrix& viewMatrix, 73 const SkMatrix& viewMatrix,
65 const SkRect& rect, 74 const SkRect& rect,
66 const SkStrokeRec& stroke) { 75 const SkStrokeRec& stroke) {
67 return GrAAStrokeRectBatch::Create(color, viewMatrix, rect, stroke); 76 return GrAAStrokeRectBatch::Create(color, viewMatrix, rect, stroke);
68 } 77 }
69 78
70 // First rect is outer; second rect is inner 79 // First rect is outer; second rect is inner
71 GrDrawBatch* CreateAAFillNestedRects(GrColor, 80 GrDrawBatch* CreateAAFillNestedRects(GrColor,
72 const SkMatrix& viewMatrix, 81 const SkMatrix& viewMatrix,
73 const SkRect rects[2]); 82 const SkRect rects[2]);
74 83
75 }; 84 };
76 85
77 #endif 86 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrNonAAStrokeRectBatch.h ('k') | src/gpu/draws/GrDraw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698