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

Side by Side Diff: gm/pictureimagefilter.cpp

Issue 182983003: Factory methods for heap-allocated SkImageFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years, 9 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/offsetimagefilter.cpp ('k') | gm/resizeimagefilter.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 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 "gm.h" 8 #include "gm.h"
9 9
10 #include "SkPictureImageFilter.h" 10 #include "SkPictureImageFilter.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 canvas->drawPaint(paint); 47 canvas->drawPaint(paint);
48 canvas->restore(); 48 canvas->restore();
49 } 49 }
50 50
51 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 51 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
52 canvas->clear(0x00000000); 52 canvas->clear(0x00000000);
53 { 53 {
54 SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30); 54 SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30);
55 SkRect emptyRect = SkRect::MakeXYWH(20, 20, 0, 0); 55 SkRect emptyRect = SkRect::MakeXYWH(20, 20, 0, 0);
56 SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); 56 SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100);
57 SkAutoTUnref<SkImageFilter> pictureSource(new SkPictureImageFilter(& fPicture)); 57 SkAutoTUnref<SkImageFilter> pictureSource(SkPictureImageFilter::Crea te(&fPicture));
58 SkAutoTUnref<SkImageFilter> pictureSourceSrcRect(new SkPictureImageF ilter(&fPicture, srcRect)); 58 SkAutoTUnref<SkImageFilter> pictureSourceSrcRect(SkPictureImageFilte r::Create(&fPicture, srcRect));
59 SkAutoTUnref<SkImageFilter> pictureSourceEmptyRect(new SkPictureImag eFilter(&fPicture, emptyRect)); 59 SkAutoTUnref<SkImageFilter> pictureSourceEmptyRect(SkPictureImageFil ter::Create(&fPicture, emptyRect));
60 60
61 // Draw the picture unscaled. 61 // Draw the picture unscaled.
62 fillRectFiltered(canvas, bounds, pictureSource); 62 fillRectFiltered(canvas, bounds, pictureSource);
63 canvas->translate(SkIntToScalar(100), 0); 63 canvas->translate(SkIntToScalar(100), 0);
64 64
65 // Draw an unscaled subset of the source picture. 65 // Draw an unscaled subset of the source picture.
66 fillRectFiltered(canvas, bounds, pictureSourceSrcRect); 66 fillRectFiltered(canvas, bounds, pictureSourceSrcRect);
67 canvas->translate(SkIntToScalar(100), 0); 67 canvas->translate(SkIntToScalar(100), 0);
68 68
69 // Draw the picture to an empty rect (should draw nothing). 69 // Draw the picture to an empty rect (should draw nothing).
(...skipping 12 matching lines...) Expand all
82 } 82 }
83 83
84 private: 84 private:
85 SkPicture fPicture; 85 SkPicture fPicture;
86 typedef GM INHERITED; 86 typedef GM INHERITED;
87 }; 87 };
88 88
89 /////////////////////////////////////////////////////////////////////////////// 89 ///////////////////////////////////////////////////////////////////////////////
90 90
91 DEF_GM( return new PictureImageFilterGM; ) 91 DEF_GM( return new PictureImageFilterGM; )
OLDNEW
« no previous file with comments | « gm/offsetimagefilter.cpp ('k') | gm/resizeimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698