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

Side by Side Diff: gm/dropshadowimagefilter.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/displacement.cpp ('k') | gm/imageblur.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 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 SkAutoTUnref<SkColorFilter> cf( 126 SkAutoTUnref<SkColorFilter> cf(
127 SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_ Mode)); 127 SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_ Mode));
128 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get ())); 128 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get ()));
129 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), 129 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
130 SkImageFilter::CropRect::kHasAll_CropEd ge); 130 SkImageFilter::CropRect::kHasAll_CropEd ge);
131 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)), 131 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)),
132 SkImageFilter::CropRect::kHasAll_CropE dge); 132 SkImageFilter::CropRect::kHasAll_CropE dge);
133 133
134 SkImageFilter* filters[] = { 134 SkImageFilter* filters[] = {
135 NULL, 135 NULL,
136 new SkDropShadowImageFilter(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE), 136 SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE ),
137 new SkDropShadowImageFilter(0.0f, 7.0f, 3.0f, 0.0f, SK_ColorBLUE), 137 SkDropShadowImageFilter::Create(0.0f, 7.0f, 3.0f, 0.0f, SK_ColorBLUE ),
138 new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE), 138 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE ),
139 new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, cf if), 139 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE , cfif),
140 new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, NU LL, &cropRect), 140 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE , NULL, &cropRect),
141 new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, NU LL, &bogusRect), 141 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE , NULL, &bogusRect),
142 }; 142 };
143 143
144 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 144 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
145 SkScalar MARGIN = SkIntToScalar(16); 145 SkScalar MARGIN = SkIntToScalar(16);
146 SkScalar DX = r.width() + MARGIN; 146 SkScalar DX = r.width() + MARGIN;
147 SkScalar DY = r.height() + MARGIN; 147 SkScalar DY = r.height() + MARGIN;
148 148
149 canvas->translate(MARGIN, MARGIN); 149 canvas->translate(MARGIN, MARGIN);
150 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) { 150 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) {
151 canvas->save(); 151 canvas->save();
(...skipping 11 matching lines...) Expand all
163 } 163 }
164 164
165 private: 165 private:
166 typedef GM INHERITED; 166 typedef GM INHERITED;
167 }; 167 };
168 168
169 /////////////////////////////////////////////////////////////////////////////// 169 ///////////////////////////////////////////////////////////////////////////////
170 170
171 static skiagm::GM* MyFactory(void*) { return new DropShadowImageFilterGM; } 171 static skiagm::GM* MyFactory(void*) { return new DropShadowImageFilterGM; }
172 static skiagm::GMRegistry reg(MyFactory); 172 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/displacement.cpp ('k') | gm/imageblur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698