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/tablecolorfilter.cpp

Issue 1858813002: Update SkColorFilterImageFilter 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/recordopts.cpp ('k') | gm/testimagefilters.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 "SkColorFilterImageFilter.h" 10 #include "SkColorFilterImageFilter.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // each draw being at xOffset of the previous one 156 // each draw being at xOffset of the previous one
157 for (unsigned i = 1; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { 157 for (unsigned i = 1; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) {
158 x += xOffset; 158 x += xOffset;
159 paint.setColorFilter(gColorFilterMakers[i]()); 159 paint.setColorFilter(gColorFilterMakers[i]());
160 canvas->drawBitmap(bm, x, y, &paint); 160 canvas->drawBitmap(bm, x, y, &paint);
161 } 161 }
162 162
163 paint.setColorFilter(nullptr); 163 paint.setColorFilter(nullptr);
164 164
165 for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { 165 for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) {
166 auto colorFilter1(gColorFilterMakers[i]()); 166 sk_sp<SkColorFilter> colorFilter1(gColorFilterMakers[i]());
167 SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilte r::Create( 167 sk_sp<SkImageFilter> imageFilter1(SkColorFilterImageFilter::Make (
168 colorFilter1.get(), nullptr, nullptr)); 168 std::move(colorFilter1), nullptr));
169 169
170 // Move down to the next line and draw it 170 // Move down to the next line and draw it
171 // each draw being at xOffset of the previous one 171 // each draw being at xOffset of the previous one
172 y += yOffset; 172 y += yOffset;
173 x = 0; 173 x = 0;
174 for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j ) { 174 for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j ) {
175 auto colorFilter2(gColorFilterMakers[j]()); 175 sk_sp<SkColorFilter> colorFilter2(gColorFilterMakers[j]());
176 SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageF ilter::Create( 176 sk_sp<SkImageFilter> imageFilter2(SkColorFilterImageFilter:: Make(
177 colorFilter2.get(), imageFilter1, nullptr)); 177 std::move(colorFilter2), imageFilter1, nullptr)) ;
178 paint.setImageFilter(imageFilter2); 178 paint.setImageFilter(std::move(imageFilter2));
179 canvas->drawBitmap(bm, x, y, &paint); 179 canvas->drawBitmap(bm, x, y, &paint);
180 x += xOffset; 180 x += xOffset;
181 } 181 }
182 } 182 }
183 183
184 // Move down one line to the beginning of the block for next bitmap 184 // Move down one line to the beginning of the block for next bitmap
185 y += yOffset; 185 y += yOffset;
186 } 186 }
187 } 187 }
188 188
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 DEF_GM( return new ComposeColorFilterGM(gColors0, gModes0, "wacky"); ) 285 DEF_GM( return new ComposeColorFilterGM(gColors0, gModes0, "wacky"); )
286 286
287 const SkColor gColors1[] = { 0x80FF0000, 0x8000FF00, 0x800000FF }; 287 const SkColor gColors1[] = { 0x80FF0000, 0x8000FF00, 0x800000FF };
288 const SkXfermode::Mode gModes1[] = { 288 const SkXfermode::Mode gModes1[] = {
289 SkXfermode::kSrcOver_Mode, 289 SkXfermode::kSrcOver_Mode,
290 SkXfermode::kXor_Mode, 290 SkXfermode::kXor_Mode,
291 SkXfermode::kDstOut_Mode, 291 SkXfermode::kDstOut_Mode,
292 SkXfermode::kSrcATop_Mode, 292 SkXfermode::kSrcATop_Mode,
293 }; 293 };
294 DEF_GM( return new ComposeColorFilterGM(gColors1, gModes1, "alpha"); ) 294 DEF_GM( return new ComposeColorFilterGM(gColors1, gModes1, "alpha"); )
OLDNEW
« no previous file with comments | « gm/recordopts.cpp ('k') | gm/testimagefilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698