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

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

Issue 1467553002: New API for computing optimization invariants. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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/GrDrawAtlasBatch.h ('k') | src/gpu/batches/GrDrawBatch.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 "GrDrawAtlasBatch.h" 8 #include "GrDrawAtlasBatch.h"
9 #include "GrBatchFlushState.h" 9 #include "GrBatchFlushState.h"
10 #include "GrBatchTest.h" 10 #include "GrBatchTest.h"
11 #include "SkGr.h" 11 #include "SkGr.h"
12 #include "SkRandom.h" 12 #include "SkRandom.h"
13 #include "SkRSXform.h" 13 #include "SkRSXform.h"
14 14
15 void GrDrawAtlasBatch::initBatchTracker(const GrPipelineOptimizations& opt) { 15 void GrDrawAtlasBatch::initBatchTracker(const GrXPOverridesForBatch& overrides) {
16 SkASSERT(fGeoData.count() == 1); 16 SkASSERT(fGeoData.count() == 1);
17 // Handle any color overrides 17 // Handle any color overrides
18 if (!opt.readsColor()) { 18 if (!overrides.readsColor()) {
19 fGeoData[0].fColor = GrColor_ILLEGAL; 19 fGeoData[0].fColor = GrColor_ILLEGAL;
20 } 20 }
21 if (opt.getOverrideColorIfSet(&fGeoData[0].fColor) && fHasColors) { 21 if (overrides.getOverrideColorIfSet(&fGeoData[0].fColor) && fHasColors) {
22 size_t vertexStride = sizeof(SkPoint) + sizeof(SkPoint) + 22 size_t vertexStride = sizeof(SkPoint) + sizeof(SkPoint) +
23 (this->hasColors() ? sizeof(GrColor) : 0); 23 (this->hasColors() ? sizeof(GrColor) : 0);
24 uint8_t* currVertex = fGeoData[0].fVerts.begin(); 24 uint8_t* currVertex = fGeoData[0].fVerts.begin();
25 for (int i = 0; i < 4*fQuadCount; ++i) { 25 for (int i = 0; i < 4*fQuadCount; ++i) {
26 *(reinterpret_cast<GrColor*>(currVertex + sizeof(SkPoint))) = fGeoDa ta[0].fColor; 26 *(reinterpret_cast<GrColor*>(currVertex + sizeof(SkPoint))) = fGeoDa ta[0].fColor;
27 currVertex += vertexStride; 27 currVertex += vertexStride;
28 } 28 }
29 } 29 }
30 30
31 // setup batch properties 31 // setup batch properties
32 fColorIgnored = !opt.readsColor(); 32 fColorIgnored = !overrides.readsColor();
33 fColor = fGeoData[0].fColor; 33 fColor = fGeoData[0].fColor;
34 // We'd like to assert this, but we can't because of GLPrograms test 34 // We'd like to assert this, but we can't because of GLPrograms test
35 //SkASSERT(init.readsLocalCoords()); 35 //SkASSERT(init.readsLocalCoords());
36 fCoverageIgnored = !opt.readsCoverage(); 36 fCoverageIgnored = !overrides.readsCoverage();
37 } 37 }
38 38
39 static const GrGeometryProcessor* set_vertex_attributes(bool hasColors, 39 static const GrGeometryProcessor* set_vertex_attributes(bool hasColors,
40 GrColor color, 40 GrColor color,
41 const SkMatrix& viewMatr ix, 41 const SkMatrix& viewMatr ix,
42 bool coverageIgnored) { 42 bool coverageIgnored) {
43 using namespace GrDefaultGeoProcFactory; 43 using namespace GrDefaultGeoProcFactory;
44 Color gpColor(color); 44 Color gpColor(color);
45 if (hasColors) { 45 if (hasColors) {
46 gpColor.fType = Color::kAttribute_Type; 46 gpColor.fType = Color::kAttribute_Type;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 SkMatrix viewMatrix = GrTest::TestMatrix(random); 259 SkMatrix viewMatrix = GrTest::TestMatrix(random);
260 260
261 GrDrawAtlasBatch::Geometry geometry; 261 GrDrawAtlasBatch::Geometry geometry;
262 geometry.fColor = GrRandomColor(random); 262 geometry.fColor = GrRandomColor(random);
263 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be gin(), 263 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be gin(),
264 texRects.begin(), hasColors ? colors.begin() : nullptr); 264 texRects.begin(), hasColors ? colors.begin() : nullptr);
265 } 265 }
266 266
267 #endif 267 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrDrawAtlasBatch.h ('k') | src/gpu/batches/GrDrawBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698