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

Side by Side Diff: gm/imagefiltersgraph.cpp

Issue 1842243002: Update SkImageSource to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 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/imagefilterscropexpand.cpp ('k') | gm/imagefiltersscaled.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 2012 Google Inc. 2 * Copyright 2012 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 "SkArithmeticMode.h" 10 #include "SkArithmeticMode.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 SkISize onISize() override { return SkISize::Make(600, 150); } 111 SkISize onISize() override { return SkISize::Make(600, 150); }
112 112
113 void onOnceBeforeDraw() override { 113 void onOnceBeforeDraw() override {
114 fImage = SkImage::MakeFromBitmap( 114 fImage = SkImage::MakeFromBitmap(
115 sk_tool_utils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70, 96, "e")); 115 sk_tool_utils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70, 96, "e"));
116 } 116 }
117 117
118 void onDraw(SkCanvas* canvas) override { 118 void onDraw(SkCanvas* canvas) override {
119 canvas->clear(SK_ColorBLACK); 119 canvas->clear(SK_ColorBLACK);
120 { 120 {
121 sk_sp<SkImageFilter> bitmapSource(SkImageSource::Create(fImage.get() )); 121 sk_sp<SkImageFilter> bitmapSource(SkImageSource::Make(fImage));
122 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorRED, 122 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorRED,
123 SkXfermode::kS rcIn_Mode)); 123 SkXfermode::kS rcIn_Mode));
124 sk_sp<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitm apSource.get())); 124 sk_sp<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitm apSource.get()));
125 sk_sp<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur.get ())); 125 sk_sp<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur.get ()));
126 sk_sp<SkImageFilter> color(SkColorFilterImageFilter::Create(cf.get() , erode.get())); 126 sk_sp<SkImageFilter> color(SkColorFilterImageFilter::Create(cf.get() , erode.get()));
127 sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(blur, color)); 127 sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(blur, color));
128 128
129 SkPaint paint; 129 SkPaint paint;
130 paint.setImageFilter(std::move(merge)); 130 paint.setImageFilter(std::move(merge));
131 canvas->drawPaint(paint); 131 canvas->drawPaint(paint);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 239
240 sk_sp<SkImage> fImage; 240 sk_sp<SkImage> fImage;
241 241
242 typedef GM INHERITED; 242 typedef GM INHERITED;
243 }; 243 };
244 244
245 /////////////////////////////////////////////////////////////////////////////// 245 ///////////////////////////////////////////////////////////////////////////////
246 246
247 DEF_GM(return new ImageFiltersGraphGM;) 247 DEF_GM(return new ImageFiltersGraphGM;)
OLDNEW
« no previous file with comments | « gm/imagefilterscropexpand.cpp ('k') | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698