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

Side by Side Diff: samplecode/SampleTextOnPath.cpp

Issue 953383002: fuzzer fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix up width and height in initializer Created 5 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/SampleStrokePath.cpp ('k') | src/core/SkPath.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 matrix.setScale(-SK_Scalar1, -SK_Scalar1); 86 matrix.setScale(-SK_Scalar1, -SK_Scalar1);
87 matrix.postTranslate(pathLen, 0); 87 matrix.postTranslate(pathLen, 0);
88 canvas->drawTextOnPath(text, len, path, &matrix, paint); 88 canvas->drawTextOnPath(text, len, path, &matrix, paint);
89 } 89 }
90 90
91 class TextOnPathView : public SampleView { 91 class TextOnPathView : public SampleView {
92 public: 92 public:
93 SkPath fPath; 93 SkPath fPath;
94 SkScalar fHOffset; 94 SkScalar fHOffset;
95 95
96 TextOnPathView() { 96 protected:
97 void onOnceBeforeDraw() SK_OVERRIDE {
97 SkRect r; 98 SkRect r;
98 r.set(SkIntToScalar(100), SkIntToScalar(100), 99 r.set(SkIntToScalar(100), SkIntToScalar(100),
99 SkIntToScalar(300), SkIntToScalar(300)); 100 SkIntToScalar(300), SkIntToScalar(300));
100 fPath.addOval(r); 101 fPath.addOval(r);
101 fPath.offset(SkIntToScalar(-50), SkIntToScalar(-50)); 102 fPath.offset(SkIntToScalar(-50), SkIntToScalar(-50));
102 103
103 fHOffset = SkIntToScalar(50); 104 fHOffset = SkIntToScalar(50);
104 } 105 }
105 106
106 protected:
107 // overrides from SkEventSink 107 // overrides from SkEventSink
108 bool onQuery(SkEvent* evt) SK_OVERRIDE { 108 bool onQuery(SkEvent* evt) SK_OVERRIDE {
109 if (SampleCode::TitleQ(*evt)) { 109 if (SampleCode::TitleQ(*evt)) {
110 SampleCode::TitleR(evt, "Text On Path"); 110 SampleCode::TitleR(evt, "Text On Path");
111 return true; 111 return true;
112 } 112 }
113 return this->INHERITED::onQuery(evt); 113 return this->INHERITED::onQuery(evt);
114 } 114 }
115 115
116 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 116 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
(...skipping 49 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 | « samplecode/SampleStrokePath.cpp ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698