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

Side by Side Diff: samplecode/SampleEmboss.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 Created 4 years, 9 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/SampleCamera.cpp ('k') | samplecode/SampleFilterFuzz.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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkView.h" 10 #include "SkView.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkColorShader.h"
13 #include "SkEmbossMaskFilter.h" 12 #include "SkEmbossMaskFilter.h"
14 #include "SkGradientShader.h" 13 #include "SkGradientShader.h"
15 #include "SkGraphics.h" 14 #include "SkGraphics.h"
16 #include "SkPath.h" 15 #include "SkPath.h"
17 #include "SkRandom.h" 16 #include "SkRandom.h"
18 #include "SkRegion.h" 17 #include "SkRegion.h"
19 #include "SkShader.h" 18 #include "SkShader.h"
20 #include "SkUtils.h" 19 #include "SkUtils.h"
21 #include "SkColorPriv.h" 20 #include "SkColorPriv.h"
22 #include "SkColorFilter.h" 21 #include "SkColorFilter.h"
(...skipping 23 matching lines...) Expand all
46 } 45 }
47 46
48 virtual void onDrawContent(SkCanvas* canvas) { 47 virtual void onDrawContent(SkCanvas* canvas) {
49 SkPaint paint; 48 SkPaint paint;
50 49
51 paint.setAntiAlias(true); 50 paint.setAntiAlias(true);
52 paint.setStyle(SkPaint::kStroke_Style); 51 paint.setStyle(SkPaint::kStroke_Style);
53 paint.setStrokeWidth(SkIntToScalar(10)); 52 paint.setStrokeWidth(SkIntToScalar(10));
54 paint.setMaskFilter(SkEmbossMaskFilter::Create( 53 paint.setMaskFilter(SkEmbossMaskFilter::Create(
55 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)), fLight))->unref( ); 54 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)), fLight))->unref( );
56 paint.setShader(new SkColorShader(SK_ColorBLUE))->unref(); 55 paint.setShader(SkShader::MakeColorShader(SK_ColorBLUE));
57 paint.setDither(true); 56 paint.setDither(true);
58 57
59 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), 58 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50),
60 SkIntToScalar(30), paint); 59 SkIntToScalar(30), paint);
61 } 60 }
62 61
63 private: 62 private:
64 63
65 typedef SampleView INHERITED; 64 typedef SampleView INHERITED;
66 }; 65 };
67 66
68 ////////////////////////////////////////////////////////////////////////////// 67 //////////////////////////////////////////////////////////////////////////////
69 68
70 static SkView* MyFactory() { return new EmbossView; } 69 static SkView* MyFactory() { return new EmbossView; }
71 static SkViewRegister reg(MyFactory); 70 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleCamera.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698