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

Side by Side Diff: gm/imagefilters.cpp

Issue 1860573002: Update SkMorphology ImageFilters 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 | « bench/MorphologyBench.cpp ('k') | gm/imagefiltersclipped.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 2015 Google Inc. 2 * Copyright 2015 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 "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColorMatrixFilter.h" 10 #include "SkColorMatrixFilter.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } else { 132 } else {
133 dx = 0; 133 dx = 0;
134 dy = offset; 134 dy = offset;
135 } 135 }
136 } 136 }
137 } 137 }
138 138
139 DEF_SIMPLE_GM(savelayer_with_backdrop, canvas, 830, 550) { 139 DEF_SIMPLE_GM(savelayer_with_backdrop, canvas, 830, 550) {
140 SkColorMatrix cm; 140 SkColorMatrix cm;
141 cm.setSaturation(10); 141 cm.setSaturation(10);
142 auto cf(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)); 142 sk_sp<SkColorFilter> cf(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat)) ;
143 const SkScalar kernel[] = { 4, 0, 4, 0, -15, 0, 4, 0, 4 }; 143 const SkScalar kernel[] = { 4, 0, 4, 0, -15, 0, 4, 0, 4 };
144 SkImageFilter* filters[] = { 144 SkImageFilter* filters[] = {
145 SkBlurImageFilter::Make(10, 10, nullptr).release(), 145 SkBlurImageFilter::Make(10, 10, nullptr).release(),
146 SkDilateImageFilter::Create(8, 8), 146 SkDilateImageFilter::Make(8, 8, nullptr).release(),
147 SkMatrixConvolutionImageFilter::Create({ 3, 3 }, kernel, 1, 0, { 0, 0 }, 147 SkMatrixConvolutionImageFilter::Create({ 3, 3 }, kernel, 1, 0, { 0, 0 },
148 SkMatrixConvolutionImageFilter::kClam pToBlack_TileMode, 148 SkMatrixConvolutionImageFilter::kClam pToBlack_TileMode,
149 true), 149 true),
150 SkColorFilterImageFilter::Create(cf.get()), 150 SkColorFilterImageFilter::Create(cf.get()),
151 }; 151 };
152 152
153 const struct { 153 const struct {
154 SkScalar fSx, fSy, fTx, fTy; 154 SkScalar fSx, fSy, fTx, fTy;
155 } xforms[] = { 155 } xforms[] = {
156 { 1, 1, 0, 0 }, 156 { 1, 1, 0, 0 },
(...skipping 13 matching lines...) Expand all
170 canvas->scale(xform.fSx, xform.fSy); 170 canvas->scale(xform.fSx, xform.fSy);
171 canvas->drawImage(image, 0, 0, &paint); 171 canvas->drawImage(image, 0, 0, &paint);
172 draw_set(canvas, filters, SK_ARRAY_COUNT(filters)); 172 draw_set(canvas, filters, SK_ARRAY_COUNT(filters));
173 canvas->restore(); 173 canvas->restore();
174 } 174 }
175 175
176 for (auto& filter : filters) { 176 for (auto& filter : filters) {
177 filter->unref(); 177 filter->unref();
178 } 178 }
179 } 179 }
OLDNEW
« no previous file with comments | « bench/MorphologyBench.cpp ('k') | gm/imagefiltersclipped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698