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

Side by Side Diff: samplecode/SampleEffects.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 | « samplecode/SampleBlur.cpp ('k') | samplecode/SampleEmboss.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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "SkBlurMask.h" 8 #include "SkBlurMask.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkColorMatrixFilter.h" 11 #include "SkColorMatrixFilter.h"
12 #include "SkDiscretePathEffect.h" 12 #include "SkDiscretePathEffect.h"
13 #include "SkGradientShader.h" 13 #include "SkGradientShader.h"
14 #include "SkPaint.h" 14 #include "SkPaint.h"
15 #include "SkView.h" 15 #include "SkView.h"
16 16
17 17
18 //#define COLOR 0xFFFF8844 18 //#define COLOR 0xFFFF8844
19 #define COLOR 0xFF888888 19 #define COLOR 0xFF888888
20 20
21 static void paint_proc0(SkPaint*) { 21 static void paint_proc0(SkPaint*) {
22 } 22 }
23 23
24 static void paint_proc1(SkPaint* paint) { 24 static void paint_proc1(SkPaint* paint) {
25 paint->setMaskFilter(SkBlurMaskFilter::Create( 25 paint->setMaskFilter(SkBlurMaskFilter::Make(
26 kNormal_SkBlurStyle, 26 kNormal_SkBlurStyle,
27 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(2 ))))->unref(); 27 SkBlurMask::ConvertRadiusToSigma(2)));
28 } 28 }
29 29
30 static void paint_proc2(SkPaint* paint) { 30 static void paint_proc2(SkPaint* paint) {
31 SkScalar dir[3] = { 1, 1, 1}; 31 SkScalar dir[3] = { 1, 1, 1};
32 paint->setMaskFilter( 32 paint->setMaskFilter(
33 SkBlurMaskFilter::CreateEmboss(SkBlurMask::ConvertRadiusToSigma(SkIn tToScalar(1)), 33 SkBlurMaskFilter::MakeEmboss(SkBlurMask::ConvertRadiusToSigma(1), di r, 0.1f, 0.05f));
34 dir,
35 0.1f,
36 0.05f))->unref();
37 } 34 }
38 35
39 static void paint_proc3(SkPaint* paint) { 36 static void paint_proc3(SkPaint* paint) {
40 SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE }; 37 SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE };
41 SkPoint pts[] = { { 3, 0 }, { 7, 5 } }; 38 SkPoint pts[] = { { 3, 0 }, { 7, 5 } };
42 paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY _COUNT(colors), 39 paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY _COUNT(colors),
43 SkShader::kMirror_TileMode)); 40 SkShader::kMirror_TileMode));
44 } 41 }
45 42
46 static void paint_proc5(SkPaint* paint) { 43 static void paint_proc5(SkPaint* paint) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 110 }
114 111
115 private: 112 private:
116 typedef SampleView INHERITED; 113 typedef SampleView INHERITED;
117 }; 114 };
118 115
119 /////////////////////////////////////////////////////////////////////////////// 116 ///////////////////////////////////////////////////////////////////////////////
120 117
121 static SkView* MyFactory() { return new EffectsView; } 118 static SkView* MyFactory() { return new EffectsView; }
122 static SkViewRegister reg(MyFactory); 119 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleBlur.cpp ('k') | samplecode/SampleEmboss.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698