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

Side by Side Diff: src/effects/gradients/SkSweepGradient.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { 43 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const {
44 this->INHERITED::flatten(buffer); 44 this->INHERITED::flatten(buffer);
45 buffer.writePoint(fCenter); 45 buffer.writePoint(fCenter);
46 } 46 }
47 47
48 size_t SkSweepGradient::contextSize() const { 48 size_t SkSweepGradient::contextSize() const {
49 return sizeof(SweepGradientContext); 49 return sizeof(SweepGradientContext);
50 } 50 }
51 51
52 SkShader::Context* SkSweepGradient::onCreateContext(const ContextRec& rec, void* storage) const { 52 SkShader::Context* SkSweepGradient::onCreateContext(const ContextRec& rec, void* storage) const {
53 return SkNEW_PLACEMENT_ARGS(storage, SweepGradientContext, (*this, rec)); 53 return new (storage) SweepGradientContext(*this, rec);
54 } 54 }
55 55
56 SkSweepGradient::SweepGradientContext::SweepGradientContext( 56 SkSweepGradient::SweepGradientContext::SweepGradientContext(
57 const SkSweepGradient& shader, const ContextRec& rec) 57 const SkSweepGradient& shader, const ContextRec& rec)
58 : INHERITED(shader, rec) {} 58 : INHERITED(shader, rec) {}
59 59
60 // returns angle in a circle [0..2PI) -> [0..255] 60 // returns angle in a circle [0..2PI) -> [0..255]
61 static unsigned SkATan2_255(float y, float x) { 61 static unsigned SkATan2_255(float y, float x) {
62 // static const float g255Over2PI = 255 / (2 * SK_ScalarPI); 62 // static const float g255Over2PI = 255 / (2 * SK_ScalarPI);
63 static const float g255Over2PI = 40.584510488433314f; 63 static const float g255Over2PI = 40.584510488433314f;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 typedef GrGLGradientEffect INHERITED; 186 typedef GrGLGradientEffect INHERITED;
187 187
188 }; 188 };
189 189
190 ///////////////////////////////////////////////////////////////////// 190 /////////////////////////////////////////////////////////////////////
191 191
192 class GrSweepGradient : public GrGradientEffect { 192 class GrSweepGradient : public GrGradientEffect {
193 public: 193 public:
194 static GrFragmentProcessor* Create(GrContext* ctx, GrProcessorDataManager* p rocDataManager, 194 static GrFragmentProcessor* Create(GrContext* ctx, GrProcessorDataManager* p rocDataManager,
195 const SkSweepGradient& shader, const SkMa trix& m) { 195 const SkSweepGradient& shader, const SkMa trix& m) {
196 return SkNEW_ARGS(GrSweepGradient, (ctx, procDataManager, shader, m)); 196 return new GrSweepGradient(ctx, procDataManager, shader, m);
197 } 197 }
198 virtual ~GrSweepGradient() { } 198 virtual ~GrSweepGradient() { }
199 199
200 const char* name() const override { return "Sweep Gradient"; } 200 const char* name() const override { return "Sweep Gradient"; }
201 201
202 private: 202 private:
203 GrSweepGradient(GrContext* ctx, 203 GrSweepGradient(GrContext* ctx,
204 GrProcessorDataManager* procDataManager, 204 GrProcessorDataManager* procDataManager,
205 const SkSweepGradient& shader, 205 const SkSweepGradient& shader,
206 const SkMatrix& matrix) 206 const SkMatrix& matrix)
207 : INHERITED(ctx, procDataManager, shader, matrix, SkShader::kClamp_TileMode) { 207 : INHERITED(ctx, procDataManager, shader, matrix, SkShader::kClamp_TileMode) {
208 this->initClassID<GrSweepGradient>(); 208 this->initClassID<GrSweepGradient>();
209 } 209 }
210 210
211 GrGLFragmentProcessor* onCreateGLInstance() const override { 211 GrGLFragmentProcessor* onCreateGLInstance() const override {
212 return SkNEW_ARGS(GrGLSweepGradient, (*this)); 212 return new GrGLSweepGradient(*this);
213 } 213 }
214 214
215 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, 215 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
216 GrProcessorKeyBuilder* b) const override { 216 GrProcessorKeyBuilder* b) const override {
217 GrGLSweepGradient::GenKey(*this, caps, b); 217 GrGLSweepGradient::GenKey(*this, caps, b);
218 } 218 }
219 219
220 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 220 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
221 221
222 typedef GrGradientEffect INHERITED; 222 typedef GrGradientEffect INHERITED;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 str->appendScalar(fCenter.fX); 314 str->appendScalar(fCenter.fX);
315 str->append(", "); 315 str->append(", ");
316 str->appendScalar(fCenter.fY); 316 str->appendScalar(fCenter.fY);
317 str->append(") "); 317 str->append(") ");
318 318
319 this->INHERITED::toString(str); 319 this->INHERITED::toString(str);
320 320
321 str->append(")"); 321 str->append(")");
322 } 322 }
323 #endif 323 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698