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

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

Issue 749413003: get rid of static gps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup remove static procs Created 6 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/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrOvalRenderer.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 #include "GrDefaultGeoProcFactory.h" 8 #include "GrDefaultGeoProcFactory.h"
9 9
10 #include "GrDrawState.h" 10 #include "GrDrawState.h"
11 #include "GrInvariantOutput.h" 11 #include "GrInvariantOutput.h"
12 #include "gl/GrGLGeometryProcessor.h" 12 #include "gl/GrGLGeometryProcessor.h"
13 #include "gl/builders/GrGLProgramBuilder.h" 13 #include "gl/builders/GrGLProgramBuilder.h"
14 14
15 /* 15 /*
16 * The default Geometry Processor simply takes position and multiplies it by the uniform view 16 * The default Geometry Processor simply takes position and multiplies it by the uniform view
17 * matrix. It also leaves coverage untouched. Behind the scenes, we may add per vertex color or 17 * matrix. It also leaves coverage untouched. Behind the scenes, we may add per vertex color or
18 * local coords. 18 * local coords.
19 */ 19 */
20 typedef GrDefaultGeoProcFactory Flag; 20 typedef GrDefaultGeoProcFactory Flag;
21 21
22 class DefaultGeoProc : public GrGeometryProcessor { 22 class DefaultGeoProc : public GrGeometryProcessor {
23 public: 23 public:
24 static GrGeometryProcessor* Create(uint32_t gpTypeFlags) { 24 static GrGeometryProcessor* Create(uint32_t gpTypeFlags) {
25 switch (gpTypeFlags) { 25 return SkNEW_ARGS(DefaultGeoProc, (gpTypeFlags));
26 case Flag::kColor_GPType | Flag::kCoverage_GPType | Flag::kLocalCoor d_GPType: {
27 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProcColLocCov, DefaultGeoP roc, (gpTypeFlags));
28 return SkRef(gDefaultGeoProcColLocCov);
29 }
30 case Flag::kColor_GPType | Flag::kLocalCoord_GPType: {
31 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProcColLoc, DefaultGeoProc , (gpTypeFlags));
32 return SkRef(gDefaultGeoProcColLoc);
33 }
34 case Flag::kColor_GPType | Flag::kCoverage_GPType: {
35 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProcColCov, DefaultGeoProc , (gpTypeFlags));
36 return SkRef(gDefaultGeoProcColCov);
37 }
38 case Flag::kColor_GPType: {
39 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProcCol, DefaultGeoProc, ( gpTypeFlags));
40 return SkRef(gDefaultGeoProcCol);
41 }
42 case Flag::kLocalCoord_GPType | Flag::kCoverage_GPType: {
43 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProcLocCov, DefaultGeoProc , (gpTypeFlags));
44 return SkRef(gDefaultGeoProcLocCov);
45 }
46 case Flag::kLocalCoord_GPType: {
47 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProcLoc, DefaultGeoProc, ( gpTypeFlags));
48 return SkRef(gDefaultGeoProcLoc);
49 }
50 case Flag::kCoverage_GPType: {
51 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProcCov, DefaultGeoProc, ( gpTypeFlags));
52 return SkRef(gDefaultGeoProcCov);
53 }
54 case Flag::kPosition_GPType: {
55 GR_CREATE_STATIC_PROCESSOR(gDefaultGeoProc, DefaultGeoProc, (gpT ypeFlags));
56 return SkRef(gDefaultGeoProc);
57 }
58 default:
59 SkFAIL("Incomplete Switch");
60 return NULL;
61 }
62 } 26 }
63 27
64 virtual const char* name() const SK_OVERRIDE { return "DefaultGeometryProces sor"; } 28 virtual const char* name() const SK_OVERRIDE { return "DefaultGeometryProces sor"; }
65 29
66 const GrAttribute* inPosition() const { return fInPosition; } 30 const GrAttribute* inPosition() const { return fInPosition; }
67 const GrAttribute* inColor() const { return fInColor; } 31 const GrAttribute* inColor() const { return fInColor; }
68 const GrAttribute* inLocalCoords() const { return fInLocalCoords; } 32 const GrAttribute* inLocalCoords() const { return fInLocalCoords; }
69 const GrAttribute* inCoverage() const { return fInCoverage; } 33 const GrAttribute* inCoverage() const { return fInCoverage; }
70 34
71 class GLProcessor : public GrGLGeometryProcessor { 35 class GLProcessor : public GrGLGeometryProcessor {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (random->nextBool()) { 162 if (random->nextBool()) {
199 flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType; 163 flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType;
200 } 164 }
201 165
202 return DefaultGeoProc::Create(flags); 166 return DefaultGeoProc::Create(flags);
203 } 167 }
204 168
205 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags) { 169 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags) {
206 return DefaultGeoProc::Create(gpTypeFlags); 170 return DefaultGeoProc::Create(gpTypeFlags);
207 } 171 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698