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

Side by Side Diff: gm/imagefilterscropped.cpp

Issue 1847583002: Update SkMergeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to To 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/imagefiltersbase.cpp ('k') | gm/imagefiltersgraph.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 draw_bitmap, draw_path, draw_paint, draw_text 115 draw_bitmap, draw_path, draw_paint, draw_text
116 }; 116 };
117 117
118 auto cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_M ode)); 118 auto cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_M ode));
119 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); 119 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge);
120 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge); 120 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge);
121 121
122 SkAutoTUnref<SkImageFilter> offset(SkOffsetImageFilter::Create( 122 SkAutoTUnref<SkImageFilter> offset(SkOffsetImageFilter::Create(
123 SkIntToScalar(-10), SkIntToScalar(-10))); 123 SkIntToScalar(-10), SkIntToScalar(-10)));
124 124
125 SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf .get(), offset.get())); 125 sk_sp<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(), offset.get()));
126 126
127 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null ptr, &cropRect)); 127 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null ptr, &cropRect));
128 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null ptr, &cropRect)); 128 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null ptr, &cropRect));
129 129
130 SkImageFilter* filters[] = { 130 SkImageFilter* filters[] = {
131 nullptr, 131 nullptr,
132 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect), 132 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect),
133 SkBlurImageFilter::Create(0.0f, 0.0f, nullptr, &cropRect), 133 SkBlurImageFilter::Create(0.0f, 0.0f, nullptr, &cropRect),
134 SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect), 134 SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect),
135 SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect), 135 SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect),
136 SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect), 136 SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect),
137 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect), 137 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect),
138 SkErodeImageFilter::Create(1, 1, nullptr, &cropRect), 138 SkErodeImageFilter::Create(1, 1, nullptr, &cropRect),
139 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect), 139 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect),
140 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect), 140 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect),
141 SkErodeImageFilter::Create(8, 8, nullptr, &cropRect), 141 SkErodeImageFilter::Create(8, 8, nullptr, &cropRect),
142 SkMergeImageFilter::Create(nullptr, cfOffset.get(), SkXfermode::kSrc Over_Mode, &cropRect), 142 SkMergeImageFilter::Make(nullptr, std::move(cfOffset),
143 SkXfermode::kSrcOver_Mode, &cropRect).relea se(),
143 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect), 144 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect),
144 SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect), 145 SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect),
145 }; 146 };
146 147
147 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 148 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
148 SkScalar MARGIN = SkIntToScalar(16); 149 SkScalar MARGIN = SkIntToScalar(16);
149 SkScalar DX = r.width() + MARGIN; 150 SkScalar DX = r.width() + MARGIN;
150 SkScalar DY = r.height() + MARGIN; 151 SkScalar DY = r.height() + MARGIN;
151 152
152 canvas->translate(MARGIN, MARGIN); 153 canvas->translate(MARGIN, MARGIN);
(...skipping 15 matching lines...) Expand all
168 } 169 }
169 170
170 private: 171 private:
171 SkBitmap fCheckerboard; 172 SkBitmap fCheckerboard;
172 typedef GM INHERITED; 173 typedef GM INHERITED;
173 }; 174 };
174 175
175 /////////////////////////////////////////////////////////////////////////////// 176 ///////////////////////////////////////////////////////////////////////////////
176 177
177 DEF_GM( return new ImageFiltersCroppedGM; ) 178 DEF_GM( return new ImageFiltersCroppedGM; )
OLDNEW
« no previous file with comments | « gm/imagefiltersbase.cpp ('k') | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698