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

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 1820303002: Revert of switch colorfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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/imagefilters.cpp ('k') | gm/imagefilterscropexpand.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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 canvas->drawRect(r, paint); 185 canvas->drawRect(r, paint);
186 } 186 }
187 187
188 void onDraw(SkCanvas* canvas) override { 188 void onDraw(SkCanvas* canvas) override {
189 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { 189 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = {
190 draw_paint, 190 draw_paint,
191 draw_line, draw_rect, draw_path, draw_text, 191 draw_line, draw_rect, draw_path, draw_text,
192 draw_bitmap, 192 draw_bitmap,
193 }; 193 };
194 194
195 auto cf = SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_ Mode); 195 SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED,
196 SkXfermode::kSrcIn_Mode);
196 SkImageFilter* filters[] = { 197 SkImageFilter* filters[] = {
197 nullptr, 198 nullptr,
198 IdentityImageFilter::Create(), 199 IdentityImageFilter::Create(),
199 FailImageFilter::Create(), 200 FailImageFilter::Create(),
200 SkColorFilterImageFilter::Create(cf.get()), 201 SkColorFilterImageFilter::Create(cf),
201 SkBlurImageFilter::Create(12.0f, 0.0f), 202 SkBlurImageFilter::Create(12.0f, 0.0f),
202 SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, 3.0f, SK_ColorBLU E, 203 SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, 3.0f, SK_ColorBLU E,
203 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), 204 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
204 }; 205 };
206 cf->unref();
205 207
206 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 208 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
207 SkScalar MARGIN = SkIntToScalar(16); 209 SkScalar MARGIN = SkIntToScalar(16);
208 SkScalar DX = r.width() + MARGIN; 210 SkScalar DX = r.width() + MARGIN;
209 SkScalar DY = r.height() + MARGIN; 211 SkScalar DY = r.height() + MARGIN;
210 212
211 canvas->translate(MARGIN, MARGIN); 213 canvas->translate(MARGIN, MARGIN);
212 for (size_t i = 0; i < SK_ARRAY_COUNT(drawProc); ++i) { 214 for (size_t i = 0; i < SK_ARRAY_COUNT(drawProc); ++i) {
213 canvas->save(); 215 canvas->save();
214 for (size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) { 216 for (size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 paint->setImageFilter(SkBlurImageFilter::Create(1.5f, 1.5f))->unref(); 313 paint->setImageFilter(SkBlurImageFilter::Create(1.5f, 1.5f))->unref();
312 } 314 }
313 }; 315 };
314 DEF_GM( return new ImageFiltersText_IF; ) 316 DEF_GM( return new ImageFiltersText_IF; )
315 317
316 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { 318 class ImageFiltersText_CF : public ImageFiltersTextBaseGM {
317 public: 319 public:
318 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} 320 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {}
319 321
320 void installFilter(SkPaint* paint) override { 322 void installFilter(SkPaint* paint) override {
321 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer mode::kSrcIn_Mode)); 323 paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXf ermode::kSrcIn_Mode))->unref();
322 } 324 }
323 }; 325 };
324 DEF_GM( return new ImageFiltersText_CF; ) 326 DEF_GM( return new ImageFiltersText_CF; )
325 327
OLDNEW
« no previous file with comments | « gm/imagefilters.cpp ('k') | gm/imagefilterscropexpand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698