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

Side by Side Diff: samplecode/SampleTextOnPath.cpp

Issue 232913003: Make sure SkDrawLooper objects can only be allocated on the heap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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 | « include/effects/SkLayerDrawLooper.h ('k') | samplecode/SampleTiling.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 /* 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(new SkBlurDrawLooper(SK_ColorBLACK, 38 paint.setLooper(SkBlurDrawLooper::Create(SK_ColorBLACK,
39 SkBlurMask::ConvertRadiusToSigma(0.002f ), 39 SkBlurMask::ConvertRadiusToSigma(0. 002f),
40 0.0f, 40 0.0f,
41 0.0f))->unref(); 41 0.0f))->unref();
42 42
43 const char* text = "DRAWING STROKED TEXT WITH A BLUR ON A PATH"; 43 const char* text = "DRAWING STROKED TEXT WITH A BLUR ON A PATH";
44 size_t len = strlen(text); 44 size_t len = strlen(text);
45 45
46 canvas->drawTextOnPathHV(text, len, path, 0, 46 canvas->drawTextOnPathHV(text, len, path, 0,
47 -0.025f, paint); 47 -0.025f, paint);
48 canvas->restore(); 48 canvas->restore();
49 } 49 }
50 50
51 static void textPathMatrix(SkCanvas* canvas) { 51 static void textPathMatrix(SkCanvas* canvas) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 typedef SampleView INHERITED; 166 typedef SampleView INHERITED;
167 }; 167 };
168 168
169 ////////////////////////////////////////////////////////////////////////////// 169 //////////////////////////////////////////////////////////////////////////////
170 170
171 static SkView* MyFactory() { 171 static SkView* MyFactory() {
172 return new TextOnPathView; 172 return new TextOnPathView;
173 } 173 }
174 174
175 static SkViewRegister reg(MyFactory); 175 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkLayerDrawLooper.h ('k') | samplecode/SampleTiling.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698