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

Side by Side Diff: gm/multipicturedraw.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 | « gm/modecolorfilters.cpp ('k') | gm/patch.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 * 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 "gm.h" 8 #include "gm.h"
9 9
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 252
253 return surface; 253 return surface;
254 } 254 }
255 255
256 // This class stores the information required to compose all the result 256 // This class stores the information required to compose all the result
257 // fragments potentially generated by the MultiPictureDraw object 257 // fragments potentially generated by the MultiPictureDraw object
258 class ComposeStep { 258 class ComposeStep {
259 public: 259 public:
260 ComposeStep() : fSurf(NULL), fX(0.0f), fY(0.0f), fPaint(NULL) { } 260 ComposeStep() : fSurf(NULL), fX(0.0f), fY(0.0f), fPaint(NULL) { }
261 ~ComposeStep() { SkSafeUnref(fSurf); SkDELETE(fPaint); } 261 ~ComposeStep() {
262 SkSafeUnref(fSurf);
263 delete fPaint;
264 }
262 265
263 SkSurface* fSurf; 266 SkSurface* fSurf;
264 SkScalar fX; 267 SkScalar fX;
265 SkScalar fY; 268 SkScalar fY;
266 SkPaint* fPaint; 269 SkPaint* fPaint;
267 }; 270 };
268 271
269 typedef void (*PFContentMtd)(SkCanvas* canvas, const SkPicture* pictures[kNumPic tures]); 272 typedef void (*PFContentMtd)(SkCanvas* canvas, const SkPicture* pictures[kNumPic tures]);
270 273
271 // Just a single picture with no clip 274 // Just a single picture with no clip
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 { SK_ColorCYAN, SK_ColorMAGENTA }, 411 { SK_ColorCYAN, SK_ColorMAGENTA },
409 { SK_ColorYELLOW, SK_ColorGREEN } 412 { SK_ColorYELLOW, SK_ColorGREEN }
410 }; 413 };
411 414
412 for (int y = 0; y < kNumTilesY; ++y) { 415 for (int y = 0; y < kNumTilesY; ++y) {
413 for (int x = 0; x < kNumTilesX; ++x) { 416 for (int x = 0; x < kNumTilesX; ++x) {
414 ComposeStep& step = composeSteps->push_back(); 417 ComposeStep& step = composeSteps->push_back();
415 418
416 step.fX = SkIntToScalar(x*kTileWidth); 419 step.fX = SkIntToScalar(x*kTileWidth);
417 step.fY = SkIntToScalar(y*kTileHeight); 420 step.fY = SkIntToScalar(y*kTileHeight);
418 step.fPaint = SkNEW(SkPaint); 421 step.fPaint = new SkPaint;
419 step.fPaint->setColorFilter( 422 step.fPaint->setColorFilter(
420 SkColorFilter::CreateModeFilter(colors[x][y], SkXfermode::kModul ate_Mode))->unref(); 423 SkColorFilter::CreateModeFilter(colors[x][y], SkXfermode::kModul ate_Mode))->unref();
421 424
422 step.fSurf = create_compat_surface(finalCanvas, kTileWidth, kTileHei ght); 425 step.fSurf = create_compat_surface(finalCanvas, kTileWidth, kTileHei ght);
423 426
424 SkCanvas* subCanvas = step.fSurf->getCanvas(); 427 SkCanvas* subCanvas = step.fSurf->getCanvas();
425 428
426 const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWid th), 429 const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWid th),
427 -SkIntToScalar(y*kTileHei ght)); 430 -SkIntToScalar(y*kTileHei ght));
428 431
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 name.append(gLayoutNames[fLayout]); 536 name.append(gLayoutNames[fLayout]);
534 return name; 537 return name;
535 } 538 }
536 539
537 bool runAsBench() const override { return true; } 540 bool runAsBench() const override { return true; }
538 541
539 private: 542 private:
540 typedef GM INHERITED; 543 typedef GM INHERITED;
541 }; 544 };
542 545
543 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kNoClipSingle_ Content, 546 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kNoClipSingle_Content,
544 MultiPictureDraw::kSimple_Layout ));) 547 MultiPictureDraw::kSimple_Layout);)
545 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRectClipMulti _Content, 548 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRectClipMulti_Content,
546 MultiPictureDraw::kSimple_Layout ));) 549 MultiPictureDraw::kSimple_Layout);)
547 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRRectClipMult i_Content, 550 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRRectClipMulti_Content ,
548 MultiPictureDraw::kSimple_Layout ));) 551 MultiPictureDraw::kSimple_Layout);)
549 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kPathClipMulti _Content, 552 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content,
550 MultiPictureDraw::kSimple_Layout ));) 553 MultiPictureDraw::kSimple_Layout);)
551 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kInvPathClipMu lti_Content, 554 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Conte nt,
552 MultiPictureDraw::kSimple_Layout ));) 555 MultiPictureDraw::kSimple_Layout);)
553 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kSierpinski_Co ntent, 556 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content,
554 MultiPictureDraw::kSimple_Layout ));) 557 MultiPictureDraw::kSimple_Layout);)
555 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kBigLayer_Cont ent, 558 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content,
556 MultiPictureDraw::kSimple_Layout ));) 559 MultiPictureDraw::kSimple_Layout);)
557 560
558 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kNoClipSingle_ Content, 561 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kNoClipSingle_Content,
559 MultiPictureDraw::kTiled_Layout) );) 562 MultiPictureDraw::kTiled_Layout);)
560 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRectClipMulti _Content, 563 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRectClipMulti_Content,
561 MultiPictureDraw::kTiled_Layout) );) 564 MultiPictureDraw::kTiled_Layout);)
562 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kRRectClipMult i_Content, 565 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kRRectClipMulti_Content ,
563 MultiPictureDraw::kTiled_Layout) );) 566 MultiPictureDraw::kTiled_Layout);)
564 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kPathClipMulti _Content, 567 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content,
565 MultiPictureDraw::kTiled_Layout) );) 568 MultiPictureDraw::kTiled_Layout);)
566 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kInvPathClipMu lti_Content, 569 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Conte nt,
567 MultiPictureDraw::kTiled_Layout) );) 570 MultiPictureDraw::kTiled_Layout);)
568 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kSierpinski_Co ntent, 571 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content,
569 MultiPictureDraw::kTiled_Layout) );) 572 MultiPictureDraw::kTiled_Layout);)
570 DEF_GM(return SkNEW_ARGS(MultiPictureDraw, (MultiPictureDraw::kBigLayer_Cont ent, 573 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content,
571 MultiPictureDraw::kTiled_Layout) );) 574 MultiPictureDraw::kTiled_Layout);)
572 } 575 }
OLDNEW
« no previous file with comments | « gm/modecolorfilters.cpp ('k') | gm/patch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698