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

Side by Side Diff: src/gpu/effects/GrOvalEffect.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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
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 "GrOvalEffect.h" 8 #include "GrOvalEffect.h"
9 9
10 #include "GrFragmentProcessor.h" 10 #include "GrFragmentProcessor.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 GrPrimitiveEdgeType fEdgeType; 44 GrPrimitiveEdgeType fEdgeType;
45 45
46 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 46 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
47 47
48 typedef GrFragmentProcessor INHERITED; 48 typedef GrFragmentProcessor INHERITED;
49 }; 49 };
50 50
51 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Point& center, 51 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Point& center,
52 SkScalar radius) { 52 SkScalar radius) {
53 SkASSERT(radius >= 0); 53 SkASSERT(radius >= 0);
54 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); 54 return new CircleEffect(edgeType, center, radius);
55 } 55 }
56 56
57 void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { 57 void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
58 inout->mulByUnknownSingleComponent(); 58 inout->mulByUnknownSingleComponent();
59 } 59 }
60 60
61 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r) 61 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r)
62 : fCenter(c) 62 : fCenter(c)
63 , fRadius(r) 63 , fRadius(r)
64 , fEdgeType(edgeType) { 64 , fEdgeType(edgeType) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 //////////////////////////////////////////////////////////////////////////////// /////////////////// 172 //////////////////////////////////////////////////////////////////////////////// ///////////////////
173 173
174 void CircleEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 174 void CircleEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
175 GrProcessorKeyBuilder* b) const { 175 GrProcessorKeyBuilder* b) const {
176 GLCircleEffect::GenKey(*this, caps, b); 176 GLCircleEffect::GenKey(*this, caps, b);
177 } 177 }
178 178
179 GrGLFragmentProcessor* CircleEffect::onCreateGLInstance() const { 179 GrGLFragmentProcessor* CircleEffect::onCreateGLInstance() const {
180 return SkNEW_ARGS(GLCircleEffect, (*this)); 180 return new GLCircleEffect(*this);
181 } 181 }
182 182
183 ////////////////////////////////////////////////////////////////////////////// 183 //////////////////////////////////////////////////////////////////////////////
184 184
185 class EllipseEffect : public GrFragmentProcessor { 185 class EllipseEffect : public GrFragmentProcessor {
186 public: 186 public:
187 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPoint& cente r, SkScalar rx, 187 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPoint& cente r, SkScalar rx,
188 SkScalar ry); 188 SkScalar ry);
189 189
190 virtual ~EllipseEffect() {}; 190 virtual ~EllipseEffect() {};
(...skipping 23 matching lines...) Expand all
214 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 214 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
215 215
216 typedef GrFragmentProcessor INHERITED; 216 typedef GrFragmentProcessor INHERITED;
217 }; 217 };
218 218
219 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType, 219 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType,
220 const SkPoint& center, 220 const SkPoint& center,
221 SkScalar rx, 221 SkScalar rx,
222 SkScalar ry) { 222 SkScalar ry) {
223 SkASSERT(rx >= 0 && ry >= 0); 223 SkASSERT(rx >= 0 && ry >= 0);
224 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); 224 return new EllipseEffect(edgeType, center, rx, ry);
225 } 225 }
226 226
227 void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { 227 void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
228 inout->mulByUnknownSingleComponent(); 228 inout->mulByUnknownSingleComponent();
229 } 229 }
230 230
231 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS calar rx, SkScalar ry) 231 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS calar rx, SkScalar ry)
232 : fCenter(c) 232 : fCenter(c)
233 , fRadii(SkVector::Make(rx, ry)) 233 , fRadii(SkVector::Make(rx, ry))
234 , fEdgeType(edgeType) { 234 , fEdgeType(edgeType) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 346 }
347 347
348 //////////////////////////////////////////////////////////////////////////////// /////////////////// 348 //////////////////////////////////////////////////////////////////////////////// ///////////////////
349 349
350 void EllipseEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 350 void EllipseEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
351 GrProcessorKeyBuilder* b) const { 351 GrProcessorKeyBuilder* b) const {
352 GLEllipseEffect::GenKey(*this, caps, b); 352 GLEllipseEffect::GenKey(*this, caps, b);
353 } 353 }
354 354
355 GrGLFragmentProcessor* EllipseEffect::onCreateGLInstance() const { 355 GrGLFragmentProcessor* EllipseEffect::onCreateGLInstance() const {
356 return SkNEW_ARGS(GLEllipseEffect, (*this)); 356 return new GLEllipseEffect(*this);
357 } 357 }
358 358
359 ////////////////////////////////////////////////////////////////////////////// 359 //////////////////////////////////////////////////////////////////////////////
360 360
361 GrFragmentProcessor* GrOvalEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Rect& oval) { 361 GrFragmentProcessor* GrOvalEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Rect& oval) {
362 if (kHairlineAA_GrProcessorEdgeType == edgeType) { 362 if (kHairlineAA_GrProcessorEdgeType == edgeType) {
363 return NULL; 363 return NULL;
364 } 364 }
365 SkScalar w = oval.width(); 365 SkScalar w = oval.width();
366 SkScalar h = oval.height(); 366 SkScalar h = oval.height();
367 if (SkScalarNearlyEqual(w, h)) { 367 if (SkScalarNearlyEqual(w, h)) {
368 w /= 2; 368 w /= 2;
369 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w); 369 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w);
370 } else { 370 } else {
371 w /= 2; 371 w /= 2;
372 h /= 2; 372 h /= 2;
373 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h); 373 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h);
374 } 374 }
375 375
376 return NULL; 376 return NULL;
377 } 377 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrPorterDuffXferProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698