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

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

Issue 1282283002: Move GrStrokeRectBatch creation to behind factory (Closed) Base URL: https://skia.googlesource.com/skia.git@batchfactory2
Patch Set: feedback inc Created 5 years, 4 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/GrRectBatchFactory.h ('k') | no next file » | 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 #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 };
OLDNEW
« no previous file with comments | « src/gpu/batches/GrRectBatchFactory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698