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

Side by Side Diff: src/gpu/GrDefaultGeoProcFactory.h

Issue 1257333002: Change GrDefaultGeoProcFactory to a namespace (Closed) Base URL: https://skia.googlesource.com/skia.git@localcoordscleanup
Patch Set: 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 | « no previous file | src/gpu/GrDefaultGeoProcFactory.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 2014 Google Inc. 2 * Copyright 2014 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 GrDefaultGeoProcFactory_DEFINED 8 #ifndef GrDefaultGeoProcFactory_DEFINED
9 #define GrDefaultGeoProcFactory_DEFINED 9 #define GrDefaultGeoProcFactory_DEFINED
10 10
11 #include "GrGeometryProcessor.h" 11 #include "GrGeometryProcessor.h"
12 12
13 class GrDrawState; 13 class GrDrawState;
14 14
15 /* 15 /*
16 * A factory for creating default Geometry Processors which simply multiply posi tion by the uniform 16 * A factory for creating default Geometry Processors which simply multiply posi tion by the uniform
17 * view matrix and wire through color, coverage, UV coords if requested. Right now this is only 17 * view matrix and wire through color, coverage, UV coords if requested. Right now this is only
18 * used in the creation of optimized draw states because adding default GPs to t he drawstate can 18 * used in the creation of optimized draw states because adding default GPs to t he drawstate can
19 * interfere with batching due to updating the drawstate. 19 * interfere with batching due to updating the drawstate.
20 */ 20 */
21 class GrDefaultGeoProcFactory { 21 namespace GrDefaultGeoProcFactory {
22 public:
23 // Structs for adding vertex attributes 22 // Structs for adding vertex attributes
24 struct PositionAttr { 23 struct PositionAttr {
25 SkPoint fPosition; 24 SkPoint fPosition;
26 }; 25 };
27 26
28 struct PositionCoverageAttr { 27 struct PositionCoverageAttr {
29 SkPoint fPosition; 28 SkPoint fPosition;
30 GrColor fCoverage; 29 GrColor fCoverage;
31 }; 30 };
32 31
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 LocalCoords(Type type) : fType(type), fMatrix(NULL) {} 117 LocalCoords(Type type) : fType(type), fMatrix(NULL) {}
119 LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(ma trix) { 118 LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(ma trix) {
120 SkASSERT(kUnused_Type != type); 119 SkASSERT(kUnused_Type != type);
121 } 120 }
122 bool hasLocalMatrix() const { return NULL != fMatrix; } 121 bool hasLocalMatrix() const { return NULL != fMatrix; }
123 122
124 Type fType; 123 Type fType;
125 const SkMatrix* fMatrix; 124 const SkMatrix* fMatrix;
126 }; 125 };
127 126
128 static const GrGeometryProcessor* Create(const Color&, 127 const GrGeometryProcessor* Create(const Color&,
129 const Coverage&, 128 const Coverage&,
130 const LocalCoords&, 129 const LocalCoords&,
131 const SkMatrix& viewMatrix = SkMatr ix::I()); 130 const SkMatrix& viewMatrix = SkMatrix::I() );
132 131
133 /* 132 /*
134 * Use this factory to create a GrGeometryProcessor that expects a device sp ace vertex position 133 * Use this factory to create a GrGeometryProcessor that expects a device sp ace vertex position
135 * attribute. The view matrix must still be provided to compute correctly tr ansformed 134 * attribute. The view matrix must still be provided to compute correctly tr ansformed
136 * coordinates for GrFragmentProcessors. It may fail if the view matrix is n ot invertible. 135 * coordinates for GrFragmentProcessors. It may fail if the view matrix is n ot invertible.
137 */ 136 */
138 static const GrGeometryProcessor* CreateForDeviceSpace(const Color&, 137 const GrGeometryProcessor* CreateForDeviceSpace(const Color&,
139 const Coverage&, 138 const Coverage&,
140 const LocalCoords&, 139 const LocalCoords&,
141 const SkMatrix& viewM atrix); 140 const SkMatrix& viewMatrix);
142 141
143 // TODO deprecate this 142 // TODO deprecate this
144 static const GrGeometryProcessor* Create(uint32_t gpTypeFlags, 143 const GrGeometryProcessor* Create(uint32_t gpTypeFlags,
145 GrColor, 144 GrColor,
146 bool localCoordsWillBeRead, 145 bool localCoordsWillBeRead,
147 bool coverageWillBeIgnored, 146 bool coverageWillBeIgnored,
148 const SkMatrix& viewMatrix = SkMatr ix::I(), 147 const SkMatrix& viewMatrix = SkMatrix::I() ,
149 const SkMatrix& localMatrix = SkMat rix::I(), 148 const SkMatrix& localMatrix = SkMatrix::I( ),
150 uint8_t coverage = 0xff); 149 uint8_t coverage = 0xff);
151 150
152 static size_t DefaultVertexStride() { return sizeof(PositionAttr); } 151 inline size_t DefaultVertexStride() { return sizeof(PositionAttr); }
153 }; 152 };
154 153
155 #endif 154 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDefaultGeoProcFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698