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

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

Issue 1353683003: Move StrokeRectBatches into .cpp files (Closed) Base URL: https://skia.googlesource.com/skia.git@statics
Patch Set: tweaks Created 5 years, 3 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.cpp ('k') | src/gpu/batches/GrRectBatchFactory.cpp » ('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 "GrColor.h" 12 #include "GrColor.h"
13 #include "GrNonAAFillRectBatch.h" 13 #include "GrNonAAFillRectBatch.h"
14 #include "GrNonAAStrokeRectBatch.h"
15 #include "SkMatrix.h"
14 16
15 class GrBatch; 17 class GrBatch;
16 class SkMatrix;
17 struct SkRect; 18 struct SkRect;
18 class SkStrokeRec; 19 class SkStrokeRec;
19 20
20 /* 21 /*
21 * A factory for returning batches which can draw rectangles. 22 * A factory for returning batches which can draw rectangles.
22 */ 23 */
23 namespace GrRectBatchFactory { 24 namespace GrRectBatchFactory {
24 25
25 inline GrDrawBatch* CreateNonAAFill(GrColor color, 26 inline GrDrawBatch* CreateNonAAFill(GrColor color,
26 const SkMatrix& viewMatrix, 27 const SkMatrix& viewMatrix,
27 const SkRect& rect, 28 const SkRect& rect,
28 const SkRect* localRect, 29 const SkRect* localRect,
29 const SkMatrix* localMatrix) { 30 const SkMatrix* localMatrix) {
30 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, localRect, loca lMatrix); 31 if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspecti ve())) {
32 return GrNonAAFillRectBatch::CreateWithPerspective(color, viewMatrix, re ct, localRect,
33 localMatrix);
34 } else {
35 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix);
36 }
31 } 37 }
32 38
33 inline GrDrawBatch* CreateAAFill(GrColor color, 39 inline GrDrawBatch* CreateAAFill(GrColor color,
34 const SkMatrix& viewMatrix, 40 const SkMatrix& viewMatrix,
35 const SkRect& rect, 41 const SkRect& rect,
36 const SkRect& devRect) { 42 const SkRect& devRect) {
37 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect); 43 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
38 } 44 }
39 45
40 inline GrDrawBatch* CreateAAFill(GrColor color, 46 inline GrDrawBatch* CreateAAFill(GrColor color,
41 const SkMatrix& viewMatrix, 47 const SkMatrix& viewMatrix,
42 const SkMatrix& localMatrix, 48 const SkMatrix& localMatrix,
43 const SkRect& rect, 49 const SkRect& rect,
44 const SkRect& devRect) { 50 const SkRect& devRect) {
45 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct); 51 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct);
46 } 52 }
47 53
48 GrDrawBatch* CreateNonAAStroke(GrColor color, 54 inline GrDrawBatch* CreateNonAAStroke(GrColor color,
49 const SkMatrix& viewMatrix, 55 const SkMatrix& viewMatrix,
50 const SkRect& rect, 56 const SkRect& rect,
51 SkScalar strokeWidth, 57 SkScalar strokeWidth,
52 bool snapToPixelCenters); 58 bool snapToPixelCenters) {
59 return GrNonAAStrokeRectBatch::Create(color, viewMatrix, rect, strokeWidth, snapToPixelCenters);
60 }
53 61
54 GrDrawBatch* CreateAAStroke(GrColor, 62 GrDrawBatch* CreateAAStroke(GrColor,
55 const SkMatrix& viewMatrix, 63 const SkMatrix& viewMatrix,
56 const SkRect& rect, 64 const SkRect& rect,
57 const SkRect& devRect, 65 const SkRect& devRect,
58 const SkStrokeRec& stroke); 66 const SkStrokeRec& stroke);
59 67
60 // First rect is outer; second rect is inner 68 // First rect is outer; second rect is inner
61 GrDrawBatch* CreateAAFillNestedRects(GrColor, 69 GrDrawBatch* CreateAAFillNestedRects(GrColor,
62 const SkMatrix& viewMatrix, 70 const SkMatrix& viewMatrix,
63 const SkRect rects[2]); 71 const SkRect rects[2]);
64 72
65 }; 73 };
66 74
67 #endif 75 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrNonAAStrokeRectBatch.cpp ('k') | src/gpu/batches/GrRectBatchFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698