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

Side by Side Diff: src/effects/SkLayerDrawLooper.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
« no previous file with comments | « src/effects/SkEmbossMaskFilter.cpp ('k') | src/effects/SkLayerRasterizer.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 13 matching lines...) Expand all
24 SkLayerDrawLooper::SkLayerDrawLooper() 24 SkLayerDrawLooper::SkLayerDrawLooper()
25 : fRecs(NULL), 25 : fRecs(NULL),
26 fTopRec(NULL), 26 fTopRec(NULL),
27 fCount(0) { 27 fCount(0) {
28 } 28 }
29 29
30 SkLayerDrawLooper::~SkLayerDrawLooper() { 30 SkLayerDrawLooper::~SkLayerDrawLooper() {
31 Rec* rec = fRecs; 31 Rec* rec = fRecs;
32 while (rec) { 32 while (rec) {
33 Rec* next = rec->fNext; 33 Rec* next = rec->fNext;
34 SkDELETE(rec); 34 delete rec;
35 rec = next; 35 rec = next;
36 } 36 }
37 } 37 }
38 38
39 SkLayerDrawLooper::Context* SkLayerDrawLooper::createContext(SkCanvas* canvas, v oid* storage) const { 39 SkLayerDrawLooper::Context* SkLayerDrawLooper::createContext(SkCanvas* canvas, v oid* storage) const {
40 canvas->save(); 40 canvas->save();
41 return SkNEW_PLACEMENT_ARGS(storage, LayerDrawLooperContext, (this)); 41 return new (storage) LayerDrawLooperContext(this);
42 } 42 }
43 43
44 static SkColor xferColor(SkColor src, SkColor dst, SkXfermode::Mode mode) { 44 static SkColor xferColor(SkColor src, SkColor dst, SkXfermode::Mode mode) {
45 switch (mode) { 45 switch (mode) {
46 case SkXfermode::kSrc_Mode: 46 case SkXfermode::kSrc_Mode:
47 return src; 47 return src;
48 case SkXfermode::kDst_Mode: 48 case SkXfermode::kDst_Mode:
49 return dst; 49 return dst;
50 default: { 50 default: {
51 SkPMColor pmS = SkPreMultiplyColor(src); 51 SkPMColor pmS = SkPreMultiplyColor(src);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 SkLayerDrawLooper::Builder::Builder() 295 SkLayerDrawLooper::Builder::Builder()
296 : fRecs(NULL), 296 : fRecs(NULL),
297 fTopRec(NULL), 297 fTopRec(NULL),
298 fCount(0) { 298 fCount(0) {
299 } 299 }
300 300
301 SkLayerDrawLooper::Builder::~Builder() { 301 SkLayerDrawLooper::Builder::~Builder() {
302 Rec* rec = fRecs; 302 Rec* rec = fRecs;
303 while (rec) { 303 while (rec) {
304 Rec* next = rec->fNext; 304 Rec* next = rec->fNext;
305 SkDELETE(rec); 305 delete rec;
306 rec = next; 306 rec = next;
307 } 307 }
308 } 308 }
309 309
310 SkPaint* SkLayerDrawLooper::Builder::addLayer(const LayerInfo& info) { 310 SkPaint* SkLayerDrawLooper::Builder::addLayer(const LayerInfo& info) {
311 fCount += 1; 311 fCount += 1;
312 312
313 Rec* rec = SkNEW(Rec); 313 Rec* rec = new Rec;
314 rec->fNext = fRecs; 314 rec->fNext = fRecs;
315 rec->fInfo = info; 315 rec->fInfo = info;
316 fRecs = rec; 316 fRecs = rec;
317 if (NULL == fTopRec) { 317 if (NULL == fTopRec) {
318 fTopRec = rec; 318 fTopRec = rec;
319 } 319 }
320 320
321 return &rec->fPaint; 321 return &rec->fPaint;
322 } 322 }
323 323
324 void SkLayerDrawLooper::Builder::addLayer(SkScalar dx, SkScalar dy) { 324 void SkLayerDrawLooper::Builder::addLayer(SkScalar dx, SkScalar dy) {
325 LayerInfo info; 325 LayerInfo info;
326 326
327 info.fOffset.set(dx, dy); 327 info.fOffset.set(dx, dy);
328 (void)this->addLayer(info); 328 (void)this->addLayer(info);
329 } 329 }
330 330
331 SkPaint* SkLayerDrawLooper::Builder::addLayerOnTop(const LayerInfo& info) { 331 SkPaint* SkLayerDrawLooper::Builder::addLayerOnTop(const LayerInfo& info) {
332 fCount += 1; 332 fCount += 1;
333 333
334 Rec* rec = SkNEW(Rec); 334 Rec* rec = new Rec;
335 rec->fNext = NULL; 335 rec->fNext = NULL;
336 rec->fInfo = info; 336 rec->fInfo = info;
337 if (NULL == fRecs) { 337 if (NULL == fRecs) {
338 fRecs = rec; 338 fRecs = rec;
339 } else { 339 } else {
340 SkASSERT(fTopRec); 340 SkASSERT(fTopRec);
341 fTopRec->fNext = rec; 341 fTopRec->fNext = rec;
342 } 342 }
343 fTopRec = rec; 343 fTopRec = rec;
344 344
345 return &rec->fPaint; 345 return &rec->fPaint;
346 } 346 }
347 347
348 SkLayerDrawLooper* SkLayerDrawLooper::Builder::detachLooper() { 348 SkLayerDrawLooper* SkLayerDrawLooper::Builder::detachLooper() {
349 SkLayerDrawLooper* looper = SkNEW(SkLayerDrawLooper); 349 SkLayerDrawLooper* looper = new SkLayerDrawLooper;
350 looper->fCount = fCount; 350 looper->fCount = fCount;
351 looper->fRecs = fRecs; 351 looper->fRecs = fRecs;
352 352
353 fCount = 0; 353 fCount = 0;
354 fRecs = NULL; 354 fRecs = NULL;
355 fTopRec = NULL; 355 fTopRec = NULL;
356 356
357 return looper; 357 return looper;
358 } 358 }
OLDNEW
« no previous file with comments | « src/effects/SkEmbossMaskFilter.cpp ('k') | src/effects/SkLayerRasterizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698