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

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

Issue 1274513005: Rename GrPipelineInfo to GrPipelineOptimizations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/GrStrokeRectBatch.h ('k') | src/gpu/batches/GrTestBatch.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 #include "GrStrokeRectBatch.h" 8 #include "GrStrokeRectBatch.h"
9 #include "GrBatchTest.h" 9 #include "GrBatchTest.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 10 matching lines...) Expand all
21 SkScalar rad = SkScalarHalf(geometry.fStrokeWidth); 21 SkScalar rad = SkScalarHalf(geometry.fStrokeWidth);
22 fBounds.outset(rad, rad); 22 fBounds.outset(rad, rad);
23 geometry.fViewMatrix.mapRect(&fBounds); 23 geometry.fViewMatrix.mapRect(&fBounds);
24 24
25 // If our caller snaps to pixel centers then we have to round out the bounds 25 // If our caller snaps to pixel centers then we have to round out the bounds
26 if (snapToPixelCenters) { 26 if (snapToPixelCenters) {
27 fBounds.roundOut(); 27 fBounds.roundOut();
28 } 28 }
29 } 29 }
30 30
31 void GrStrokeRectBatch::initBatchTracker(const GrPipelineInfo& init) { 31 void GrStrokeRectBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
32 // Handle any color overrides 32 // Handle any color overrides
33 if (!init.readsColor()) { 33 if (!opt.readsColor()) {
34 fGeoData[0].fColor = GrColor_ILLEGAL; 34 fGeoData[0].fColor = GrColor_ILLEGAL;
35 } 35 }
36 init.getOverrideColorIfSet(&fGeoData[0].fColor); 36 opt.getOverrideColorIfSet(&fGeoData[0].fColor);
37 37
38 // setup batch properties 38 // setup batch properties
39 fBatch.fColorIgnored = !init.readsColor(); 39 fBatch.fColorIgnored = !opt.readsColor();
40 fBatch.fColor = fGeoData[0].fColor; 40 fBatch.fColor = fGeoData[0].fColor;
41 fBatch.fUsesLocalCoords = init.readsLocalCoords(); 41 fBatch.fUsesLocalCoords = opt.readsLocalCoords();
42 fBatch.fCoverageIgnored = !init.readsCoverage(); 42 fBatch.fCoverageIgnored = !opt.readsCoverage();
43 } 43 }
44 44
45 /* create a triangle strip that strokes the specified rect. There are 8 45 /* create a triangle strip that strokes the specified rect. There are 8
46 unique vertices, but we repeat the last 2 to close up. Alternatively we 46 unique vertices, but we repeat the last 2 to close up. Alternatively we
47 could use an indices array, and then only send 8 verts, but not sure that 47 could use an indices array, and then only send 8 verts, but not sure that
48 would be faster. 48 would be faster.
49 */ 49 */
50 static void init_stroke_rect_strip(SkPoint verts[10], const SkRect& rect, SkScal ar width) { 50 static void init_stroke_rect_strip(SkPoint verts[10], const SkRect& rect, SkScal ar width) {
51 const SkScalar rad = SkScalarHalf(width); 51 const SkScalar rad = SkScalarHalf(width);
52 // TODO we should be able to enable this assert, but we'd have to filter the se draws 52 // TODO we should be able to enable this assert, but we'd have to filter the se draws
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 GrStrokeRectBatch::Geometry geometry; 132 GrStrokeRectBatch::Geometry geometry;
133 geometry.fViewMatrix = GrTest::TestMatrix(random); 133 geometry.fViewMatrix = GrTest::TestMatrix(random);
134 geometry.fColor = GrRandomColor(random); 134 geometry.fColor = GrRandomColor(random);
135 geometry.fRect = GrTest::TestRect(random); 135 geometry.fRect = GrTest::TestRect(random);
136 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f; 136 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f;
137 137
138 return GrStrokeRectBatch::Create(geometry, random->nextBool()); 138 return GrStrokeRectBatch::Create(geometry, random->nextBool());
139 } 139 }
140 140
141 #endif 141 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrStrokeRectBatch.h ('k') | src/gpu/batches/GrTestBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698