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

Side by Side Diff: src/gpu/GrOvalRenderer.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/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/effects/GrBezierEffect.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 2013 Google Inc. 2 * Copyright 2013 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 "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 /////////////////////////////////////////////////////////////////////////////// 53 ///////////////////////////////////////////////////////////////////////////////
54 54
55 /** 55 /**
56 * The output of this effect is a modulation of the input color and coverage for a circle, 56 * The output of this effect is a modulation of the input color and coverage for a circle,
57 * specified as offset_x, offset_y (both from center point), outer radius and in ner radius. 57 * specified as offset_x, offset_y (both from center point), outer radius and in ner radius.
58 */ 58 */
59 59
60 class CircleEdgeEffect : public GrGeometryProcessor { 60 class CircleEdgeEffect : public GrGeometryProcessor {
61 public: 61 public:
62 static GrGeometryProcessor* Create(bool stroke) { 62 static GrGeometryProcessor* Create(bool stroke) {
63 GR_CREATE_STATIC_PROCESSOR(gCircleStrokeEdge, CircleEdgeEffect, (true)); 63 return SkNEW_ARGS(CircleEdgeEffect, (stroke));
64 GR_CREATE_STATIC_PROCESSOR(gCircleFillEdge, CircleEdgeEffect, (false));
65
66 if (stroke) {
67 gCircleStrokeEdge->ref();
68 return gCircleStrokeEdge;
69 } else {
70 gCircleFillEdge->ref();
71 return gCircleFillEdge;
72 }
73 } 64 }
74 65
75 const GrAttribute* inPosition() const { return fInPosition; } 66 const GrAttribute* inPosition() const { return fInPosition; }
76 const GrAttribute* inCircleEdge() const { return fInCircleEdge; } 67 const GrAttribute* inCircleEdge() const { return fInCircleEdge; }
77 virtual ~CircleEdgeEffect() {} 68 virtual ~CircleEdgeEffect() {}
78 69
79 virtual const char* name() const SK_OVERRIDE { return "CircleEdge"; } 70 virtual const char* name() const SK_OVERRIDE { return "CircleEdge"; }
80 71
81 inline bool isStroked() const { return fStroke; } 72 inline bool isStroked() const { return fStroke; }
82 73
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 * The output of this effect is a modulation of the input color and coverage for an axis-aligned 172 * The output of this effect is a modulation of the input color and coverage for an axis-aligned
182 * ellipse, specified as a 2D offset from center, and the reciprocals of the out er and inner radii, 173 * ellipse, specified as a 2D offset from center, and the reciprocals of the out er and inner radii,
183 * in both x and y directions. 174 * in both x and y directions.
184 * 175 *
185 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0. 176 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0.
186 */ 177 */
187 178
188 class EllipseEdgeEffect : public GrGeometryProcessor { 179 class EllipseEdgeEffect : public GrGeometryProcessor {
189 public: 180 public:
190 static GrGeometryProcessor* Create(bool stroke) { 181 static GrGeometryProcessor* Create(bool stroke) {
191 GR_CREATE_STATIC_PROCESSOR(gEllipseStrokeEdge, EllipseEdgeEffect, (true) ); 182 return SkNEW_ARGS(EllipseEdgeEffect, (stroke));
192 GR_CREATE_STATIC_PROCESSOR(gEllipseFillEdge, EllipseEdgeEffect, (false)) ;
193
194 if (stroke) {
195 gEllipseStrokeEdge->ref();
196 return gEllipseStrokeEdge;
197 } else {
198 gEllipseFillEdge->ref();
199 return gEllipseFillEdge;
200 }
201 } 183 }
202 184
203 virtual ~EllipseEdgeEffect() {} 185 virtual ~EllipseEdgeEffect() {}
204 186
205 virtual const char* name() const SK_OVERRIDE { return "EllipseEdge"; } 187 virtual const char* name() const SK_OVERRIDE { return "EllipseEdge"; }
206 188
207 const GrAttribute* inPosition() const { return fInPosition; } 189 const GrAttribute* inPosition() const { return fInPosition; }
208 const GrAttribute* inEllipseOffset() const { return fInEllipseOffset; } 190 const GrAttribute* inEllipseOffset() const { return fInEllipseOffset; }
209 const GrAttribute* inEllipseRadii() const { return fInEllipseRadii; } 191 const GrAttribute* inEllipseRadii() const { return fInEllipseRadii; }
210 192
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 * using differentials. 322 * using differentials.
341 * 323 *
342 * The result is device-independent and can be used with any affine matrix. 324 * The result is device-independent and can be used with any affine matrix.
343 */ 325 */
344 326
345 class DIEllipseEdgeEffect : public GrGeometryProcessor { 327 class DIEllipseEdgeEffect : public GrGeometryProcessor {
346 public: 328 public:
347 enum Mode { kStroke = 0, kHairline, kFill }; 329 enum Mode { kStroke = 0, kHairline, kFill };
348 330
349 static GrGeometryProcessor* Create(Mode mode) { 331 static GrGeometryProcessor* Create(Mode mode) {
350 GR_CREATE_STATIC_PROCESSOR(gEllipseStrokeEdge, DIEllipseEdgeEffect, (kSt roke)); 332 return SkNEW_ARGS(DIEllipseEdgeEffect, (mode));
351 GR_CREATE_STATIC_PROCESSOR(gEllipseHairlineEdge, DIEllipseEdgeEffect, (k Hairline));
352 GR_CREATE_STATIC_PROCESSOR(gEllipseFillEdge, DIEllipseEdgeEffect, (kFill ));
353
354 if (kStroke == mode) {
355 gEllipseStrokeEdge->ref();
356 return gEllipseStrokeEdge;
357 } else if (kHairline == mode) {
358 gEllipseHairlineEdge->ref();
359 return gEllipseHairlineEdge;
360 } else {
361 gEllipseFillEdge->ref();
362 return gEllipseFillEdge;
363 }
364 } 333 }
365 334
366 virtual ~DIEllipseEdgeEffect() {} 335 virtual ~DIEllipseEdgeEffect() {}
367 336
368 virtual const char* name() const SK_OVERRIDE { return "DIEllipseEdge"; } 337 virtual const char* name() const SK_OVERRIDE { return "DIEllipseEdge"; }
369 338
370 const GrAttribute* inPosition() const { return fInPosition; } 339 const GrAttribute* inPosition() const { return fInPosition; }
371 const GrAttribute* inEllipseOffsets0() const { return fInEllipseOffsets0; } 340 const GrAttribute* inEllipseOffsets0() const { return fInEllipseOffsets0; }
372 const GrAttribute* inEllipseOffsets1() const { return fInEllipseOffsets1; } 341 const GrAttribute* inEllipseOffsets1() const { return fInEllipseOffsets1; }
373 342
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : 1239 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 :
1271 SK_ARRAY_COUNT(gRRectIndices); 1240 SK_ARRAY_COUNT(gRRectIndices);
1272 target->setIndexSourceToBuffer(indexBuffer); 1241 target->setIndexSourceToBuffer(indexBuffer);
1273 target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 1 6, indexCnt, 1242 target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 1 6, indexCnt,
1274 &bounds); 1243 &bounds);
1275 } 1244 }
1276 1245
1277 target->resetIndexSource(); 1246 target->resetIndexSource();
1278 return true; 1247 return true;
1279 } 1248 }
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/effects/GrBezierEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698