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

Side by Side Diff: gm/blurrect.cpp

Issue 1852113003: switch maskfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/blurquickreject.cpp ('k') | gm/blurredclippedcircle.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 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); 76 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
77 return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX ) / 7, 77 return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX ) / 7,
78 center0, (pts[1].fX - pts[0].fX ) / 2, 78 center0, (pts[1].fX - pts[0].fX ) / 2,
79 colors, pos, SK_ARRAY_COUNT(col ors), tm, 79 colors, pos, SK_ARRAY_COUNT(col ors), tm,
80 0, &scale); 80 0, &scale);
81 } 81 }
82 82
83 typedef void (*PaintProc)(SkPaint*, SkScalar width); 83 typedef void (*PaintProc)(SkPaint*, SkScalar width);
84 84
85 class BlurRectGM : public skiagm::GM { 85 class BlurRectGM : public skiagm::GM {
86 SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1]; 86 sk_sp<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1];
87 SkString fName; 87 SkString fName;
88 SkAlpha fAlpha; 88 SkAlpha fAlpha;
89 public: 89 public:
90 BlurRectGM(const char name[], U8CPU alpha) 90 BlurRectGM(const char name[], U8CPU alpha)
91 : fName(name) 91 : fName(name)
92 , fAlpha(SkToU8(alpha)) { 92 , fAlpha(SkToU8(alpha)) {
93 } 93 }
94 94
95 protected: 95 protected:
96 void onOnceBeforeDraw() override { 96 void onOnceBeforeDraw() override {
97 for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) { 97 for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) {
98 fMaskFilters[i].reset(SkBlurMaskFilter::Create((SkBlurStyle)i, 98 fMaskFilters[i] = SkBlurMaskFilter::Make((SkBlurStyle)i,
99 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar (STROKE_WIDTH/2)), 99 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar (STROKE_WIDTH/2)),
100 SkBlurMaskFilter::kHighQuality_BlurFlag)); 100 SkBlurMaskFilter::kHighQuality_BlurFlag);
101 } 101 }
102 } 102 }
103 103
104 SkString onShortName() override { 104 SkString onShortName() override {
105 return fName; 105 return fName;
106 } 106 }
107 107
108 SkISize onISize() override { 108 SkISize onISize() override {
109 return SkISize::Make(860, 820); 109 return SkISize::Make(860, 820);
110 } 110 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (bm.height() > max_height) 225 if (bm.height() > max_height)
226 max_height = bm.height(); 226 max_height = bm.height();
227 } 227 }
228 } 228 }
229 } 229 }
230 } 230 }
231 231
232 ////////////////////////////////////////////////////////////////////////////// 232 //////////////////////////////////////////////////////////////////////////////
233 233
234 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) 234 DEF_GM(return new BlurRectGM("blurrects", 0xFF);)
OLDNEW
« no previous file with comments | « gm/blurquickreject.cpp ('k') | gm/blurredclippedcircle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698