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

Side by Side Diff: samplecode/SampleTextOnPath.cpp

Issue 1821533002: guard rasterizer and drawlooper setters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update android sdk 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurDrawLooper.h" 10 #include "SkBlurDrawLooper.h"
(...skipping 17 matching lines...) Expand all
28 path.addArc(rect, SkIntToScalar(280), SkIntToScalar(350)); 28 path.addArc(rect, SkIntToScalar(280), SkIntToScalar(350));
29 29
30 paint.setAntiAlias(true); 30 paint.setAntiAlias(true);
31 paint.setStyle(SkPaint::kStroke_Style); 31 paint.setStyle(SkPaint::kStroke_Style);
32 paint.setColor(0xFFFF0000); 32 paint.setColor(0xFFFF0000);
33 paint.setTextSize(0.085f); 33 paint.setTextSize(0.085f);
34 paint.setStrokeWidth(.005f); 34 paint.setStrokeWidth(.005f);
35 35
36 canvas->drawPath(path, paint); 36 canvas->drawPath(path, paint);
37 37
38 paint.setLooper(SkBlurDrawLooper::Create(SK_ColorBLACK, 38 paint.setLooper(SkBlurDrawLooper::Make(SK_ColorBLACK, SkBlurMask::ConvertRad iusToSigma(0.002f),
39 SkBlurMask::ConvertRadiusToSigma(0. 002f), 39 0.0f, 0.0f));
40 0.0f,
41 0.0f))->unref();
42 40
43 const char* text = "DRAWING STROKED TEXT WITH A BLUR ON A PATH"; 41 const char* text = "DRAWING STROKED TEXT WITH A BLUR ON A PATH";
44 size_t len = strlen(text); 42 size_t len = strlen(text);
45 43
46 canvas->drawTextOnPathHV(text, len, path, 0, 44 canvas->drawTextOnPathHV(text, len, path, 0,
47 -0.025f, paint); 45 -0.025f, paint);
48 canvas->restore(); 46 canvas->restore();
49 } 47 }
50 48
51 static void textPathMatrix(SkCanvas* canvas) { 49 static void textPathMatrix(SkCanvas* canvas) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 typedef SampleView INHERITED; 164 typedef SampleView INHERITED;
167 }; 165 };
168 166
169 ////////////////////////////////////////////////////////////////////////////// 167 //////////////////////////////////////////////////////////////////////////////
170 168
171 static SkView* MyFactory() { 169 static SkView* MyFactory() {
172 return new TextOnPathView; 170 return new TextOnPathView;
173 } 171 }
174 172
175 static SkViewRegister reg(MyFactory); 173 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698