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

Side by Side Diff: gm/imagefilterstransformed.cpp

Issue 1877783003: Update DisplacementMapEffect to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug 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/imagefiltersscaled.cpp ('k') | include/effects/SkDisplacementMapEffect.h » ('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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 fGradientCircle = make_gradient_circle(64, 64); 62 fGradientCircle = make_gradient_circle(64, 64);
63 } 63 }
64 64
65 void onDraw(SkCanvas* canvas) override { 65 void onDraw(SkCanvas* canvas) override {
66 sk_sp<SkImageFilter> gradient(SkImageSource::Make(fGradientCircle)); 66 sk_sp<SkImageFilter> gradient(SkImageSource::Make(fGradientCircle));
67 sk_sp<SkImageFilter> checkerboard(SkImageSource::Make(fCheckerboard)); 67 sk_sp<SkImageFilter> checkerboard(SkImageSource::Make(fCheckerboard));
68 sk_sp<SkImageFilter> filters[] = { 68 sk_sp<SkImageFilter> filters[] = {
69 SkBlurImageFilter::Make(12, 0, nullptr), 69 SkBlurImageFilter::Make(12, 0, nullptr),
70 SkDropShadowImageFilter::Make(0, 15, 8, 0, SK_ColorGREEN, 70 SkDropShadowImageFilter::Make(0, 15, 8, 0, SK_ColorGREEN,
71 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nu llptr), 71 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nu llptr),
72 sk_sp<SkImageFilter>(SkDisplacementMapEffect::Create( 72 SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSel ectorType,
73 SkDisplacementMapEffect::kR_ChannelS electorType, 73 SkDisplacementMapEffect::kR_ChannelSel ectorType,
74 SkDisplacementMapEffect::kR_ChannelS electorType, 74 12,
75 12, 75 std::move(gradient),
76 gradient.get(), 76 checkerboard),
77 checkerboard.get())),
78 SkDilateImageFilter::Make(2, 2, checkerboard), 77 SkDilateImageFilter::Make(2, 2, checkerboard),
79 SkErodeImageFilter::Make(2, 2, checkerboard), 78 SkErodeImageFilter::Make(2, 2, checkerboard),
80 }; 79 };
81 80
82 const SkScalar margin = SkIntToScalar(20); 81 const SkScalar margin = SkIntToScalar(20);
83 const SkScalar size = SkIntToScalar(60); 82 const SkScalar size = SkIntToScalar(60);
84 83
85 for (size_t j = 0; j < 3; j++) { 84 for (size_t j = 0; j < 3; j++) {
86 canvas->save(); 85 canvas->save();
87 canvas->translate(margin, 0); 86 canvas->translate(margin, 0);
(...skipping 25 matching lines...) Expand all
113 sk_sp<SkImage> fCheckerboard; 112 sk_sp<SkImage> fCheckerboard;
114 sk_sp<SkImage> fGradientCircle; 113 sk_sp<SkImage> fGradientCircle;
115 typedef GM INHERITED; 114 typedef GM INHERITED;
116 }; 115 };
117 116
118 ////////////////////////////////////////////////////////////////////////////// 117 //////////////////////////////////////////////////////////////////////////////
119 118
120 DEF_GM( return new ImageFiltersTransformedGM; ) 119 DEF_GM( return new ImageFiltersTransformedGM; )
121 120
122 } 121 }
OLDNEW
« no previous file with comments | « gm/imagefiltersscaled.cpp ('k') | include/effects/SkDisplacementMapEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698