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

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

Issue 659803004: Some cleanup in processor header files. (Closed) Base URL: https://skia.googlesource.com/skia.git@ccmat
Patch Set: rebase Created 6 years, 2 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/GrAARectRenderer.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 "gl/builders/GrGLProgramBuilder.h" 10 #include "gl/builders/GrGLProgramBuilder.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 /////////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////////
57 57
58 /** 58 /**
59 * The output of this effect is a modulation of the input color and coverage for a circle, 59 * The output of this effect is a modulation of the input color and coverage for a circle,
60 * specified as offset_x, offset_y (both from center point), outer radius and in ner radius. 60 * specified as offset_x, offset_y (both from center point), outer radius and in ner radius.
61 */ 61 */
62 62
63 class CircleEdgeEffect : public GrGeometryProcessor { 63 class CircleEdgeEffect : public GrGeometryProcessor {
64 public: 64 public:
65 static GrGeometryProcessor* Create(bool stroke) { 65 static GrGeometryProcessor* Create(bool stroke) {
66 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCircleStrokeEdge, CircleEdgeEffect, (true)); 66 GR_CREATE_STATIC_PROCESSOR(gCircleStrokeEdge, CircleEdgeEffect, (true));
67 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCircleFillEdge, CircleEdgeEffect, ( false)); 67 GR_CREATE_STATIC_PROCESSOR(gCircleFillEdge, CircleEdgeEffect, (false));
68 68
69 if (stroke) { 69 if (stroke) {
70 gCircleStrokeEdge->ref(); 70 gCircleStrokeEdge->ref();
71 return gCircleStrokeEdge; 71 return gCircleStrokeEdge;
72 } else { 72 } else {
73 gCircleFillEdge->ref(); 73 gCircleFillEdge->ref();
74 return gCircleFillEdge; 74 return gCircleFillEdge;
75 } 75 }
76 } 76 }
77 77
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 * 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
173 * 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,
174 * in both x and y directions. 174 * in both x and y directions.
175 * 175 *
176 * 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.
177 */ 177 */
178 178
179 class EllipseEdgeEffect : public GrGeometryProcessor { 179 class EllipseEdgeEffect : public GrGeometryProcessor {
180 public: 180 public:
181 static GrGeometryProcessor* Create(bool stroke) { 181 static GrGeometryProcessor* Create(bool stroke) {
182 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseStrokeEdge, EllipseEdgeEffec t, (true)); 182 GR_CREATE_STATIC_PROCESSOR(gEllipseStrokeEdge, EllipseEdgeEffect, (true) );
183 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseFillEdge, EllipseEdgeEffect, (false)); 183 GR_CREATE_STATIC_PROCESSOR(gEllipseFillEdge, EllipseEdgeEffect, (false)) ;
184 184
185 if (stroke) { 185 if (stroke) {
186 gEllipseStrokeEdge->ref(); 186 gEllipseStrokeEdge->ref();
187 return gEllipseStrokeEdge; 187 return gEllipseStrokeEdge;
188 } else { 188 } else {
189 gEllipseFillEdge->ref(); 189 gEllipseFillEdge->ref();
190 return gEllipseFillEdge; 190 return gEllipseFillEdge;
191 } 191 }
192 } 192 }
193 193
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 * using differentials. 316 * using differentials.
317 * 317 *
318 * The result is device-independent and can be used with any affine matrix. 318 * The result is device-independent and can be used with any affine matrix.
319 */ 319 */
320 320
321 class DIEllipseEdgeEffect : public GrGeometryProcessor { 321 class DIEllipseEdgeEffect : public GrGeometryProcessor {
322 public: 322 public:
323 enum Mode { kStroke = 0, kHairline, kFill }; 323 enum Mode { kStroke = 0, kHairline, kFill };
324 324
325 static GrGeometryProcessor* Create(Mode mode) { 325 static GrGeometryProcessor* Create(Mode mode) {
326 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseStrokeEdge, DIEllipseEdgeEff ect, (kStroke)); 326 GR_CREATE_STATIC_PROCESSOR(gEllipseStrokeEdge, DIEllipseEdgeEffect, (kSt roke));
327 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseHairlineEdge, DIEllipseEdgeE ffect, (kHairline)); 327 GR_CREATE_STATIC_PROCESSOR(gEllipseHairlineEdge, DIEllipseEdgeEffect, (k Hairline));
328 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseFillEdge, DIEllipseEdgeEffec t, (kFill)); 328 GR_CREATE_STATIC_PROCESSOR(gEllipseFillEdge, DIEllipseEdgeEffect, (kFill ));
329 329
330 if (kStroke == mode) { 330 if (kStroke == mode) {
331 gEllipseStrokeEdge->ref(); 331 gEllipseStrokeEdge->ref();
332 return gEllipseStrokeEdge; 332 return gEllipseStrokeEdge;
333 } else if (kHairline == mode) { 333 } else if (kHairline == mode) {
334 gEllipseHairlineEdge->ref(); 334 gEllipseHairlineEdge->ref();
335 return gEllipseHairlineEdge; 335 return gEllipseHairlineEdge;
336 } else { 336 } else {
337 gEllipseFillEdge->ref(); 337 gEllipseFillEdge->ref();
338 return gEllipseFillEdge; 338 return gEllipseFillEdge;
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 1234
1235 // drop out the middle quad if we're stroked 1235 // drop out the middle quad if we're stroked
1236 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : 1236 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 :
1237 SK_ARRAY_COUNT(gRRectIndices); 1237 SK_ARRAY_COUNT(gRRectIndices);
1238 target->setIndexSourceToBuffer(indexBuffer); 1238 target->setIndexSourceToBuffer(indexBuffer);
1239 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou nds); 1239 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou nds);
1240 } 1240 }
1241 1241
1242 return true; 1242 return true;
1243 } 1243 }
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698