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/SampleEmboss.cpp

Issue 173633003: Factory methods for heap-allocated SkMaskFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add SkTableMaskFilter::Create(table) and remove deprecated SkEmbossMaskFilter constructor. Created 6 years, 10 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/SampleAll.cpp ('k') | src/effects/SkEmbossMaskFilter.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"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 return this->INHERITED::onQuery(evt); 47 return this->INHERITED::onQuery(evt);
48 } 48 }
49 49
50 virtual void onDrawContent(SkCanvas* canvas) { 50 virtual void onDrawContent(SkCanvas* canvas) {
51 SkPaint paint; 51 SkPaint paint;
52 52
53 paint.setAntiAlias(true); 53 paint.setAntiAlias(true);
54 paint.setStyle(SkPaint::kStroke_Style); 54 paint.setStyle(SkPaint::kStroke_Style);
55 paint.setStrokeWidth(SkIntToScalar(10)); 55 paint.setStrokeWidth(SkIntToScalar(10));
56 paint.setMaskFilter(new SkEmbossMaskFilter( 56 paint.setMaskFilter(SkEmbossMaskFilter::Create(
57 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)), fLight))->unref( ); 57 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)), fLight))->unref( );
58 paint.setShader(new SkColorShader(SK_ColorBLUE))->unref(); 58 paint.setShader(new SkColorShader(SK_ColorBLUE))->unref();
59 paint.setDither(true); 59 paint.setDither(true);
60 60
61 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), 61 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50),
62 SkIntToScalar(30), paint); 62 SkIntToScalar(30), paint);
63 } 63 }
64 64
65 private: 65 private:
66 66
67 typedef SampleView INHERITED; 67 typedef SampleView INHERITED;
68 }; 68 };
69 69
70 ////////////////////////////////////////////////////////////////////////////// 70 //////////////////////////////////////////////////////////////////////////////
71 71
72 static SkView* MyFactory() { return new EmbossView; } 72 static SkView* MyFactory() { return new EmbossView; }
73 static SkViewRegister reg(MyFactory); 73 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | src/effects/SkEmbossMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698