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

Side by Side Diff: samplecode/SampleStrokePath.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, 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/SamplePathFuzz.cpp ('k') | samplecode/SampleTextOnPath.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 "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } gRec[] = { 91 } gRec[] = {
92 { SkPaint::kFill_Style, SkPaint::kMiter_Join, 0 }, 92 { SkPaint::kFill_Style, SkPaint::kMiter_Join, 0 },
93 { SkPaint::kStroke_Style, SkPaint::kMiter_Join, 0 }, 93 { SkPaint::kStroke_Style, SkPaint::kMiter_Join, 0 },
94 { SkPaint::kStroke_Style, SkPaint::kMiter_Join, 10 }, 94 { SkPaint::kStroke_Style, SkPaint::kMiter_Join, 10 },
95 { SkPaint::kStrokeAndFill_Style, SkPaint::kMiter_Join, 10 }, 95 { SkPaint::kStrokeAndFill_Style, SkPaint::kMiter_Join, 10 },
96 }; 96 };
97 97
98 class StrokePathView : public SampleView { 98 class StrokePathView : public SampleView {
99 SkScalar fWidth; 99 SkScalar fWidth;
100 SkPath fPath; 100 SkPath fPath;
101 public: 101 protected:
102 StrokePathView() { 102 void onOnceBeforeDraw() SK_OVERRIDE {
103 // test_blur(); 103 // test_blur();
104 fWidth = SkIntToScalar(120); 104 fWidth = SkIntToScalar(120);
105 105
106 #if 0 106 #if 0
107 const char str[] = 107 const char str[] =
108 "M 0, 3" 108 "M 0, 3"
109 "C 10, -10, 30, -10, 0, 28" 109 "C 10, -10, 30, -10, 0, 28"
110 "C -30, -10, -10, -10, 0, 3" 110 "C -30, -10, -10, -10, 0, 3"
111 "Z"; 111 "Z";
112 SkParsePath::FromSVGString(str, &fPath); 112 SkParsePath::FromSVGString(str, &fPath);
113 #else 113 #else
114 fPath.addCircle(0, 0, SkIntToScalar(50), SkPath::kCW_Direction); 114 fPath.addCircle(0, 0, SkIntToScalar(50), SkPath::kCW_Direction);
115 fPath.addCircle(0, SkIntToScalar(-50), SkIntToScalar(30), SkPath::kCW_Di rection); 115 fPath.addCircle(0, SkIntToScalar(-50), SkIntToScalar(30), SkPath::kCW_Di rection);
116 #endif 116 #endif
117 117
118 scale_to_width(&fPath, fWidth); 118 scale_to_width(&fPath, fWidth);
119 const SkRect& bounds = fPath.getBounds(); 119 const SkRect& bounds = fPath.getBounds();
120 fPath.offset(-bounds.fLeft, -bounds.fTop); 120 fPath.offset(-bounds.fLeft, -bounds.fTop);
121 121
122 this->setBGColor(0xFFDDDDDD); 122 this->setBGColor(0xFFDDDDDD);
123 } 123 }
124 124
125 protected:
126 // overrides from SkEventSink 125 // overrides from SkEventSink
127 bool onQuery(SkEvent* evt) SK_OVERRIDE { 126 bool onQuery(SkEvent* evt) SK_OVERRIDE {
128 if (SampleCode::TitleQ(*evt)) { 127 if (SampleCode::TitleQ(*evt)) {
129 SampleCode::TitleR(evt, "StrokePath"); 128 SampleCode::TitleR(evt, "StrokePath");
130 return true; 129 return true;
131 } 130 }
132 return this->INHERITED::onQuery(evt); 131 return this->INHERITED::onQuery(evt);
133 } 132 }
134 133
135 SkRandom rand; 134 SkRandom rand;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 return this->INHERITED::onFindClickHandler(x, y, modi); 214 return this->INHERITED::onFindClickHandler(x, y, modi);
216 } 215 }
217 private: 216 private:
218 typedef SampleView INHERITED; 217 typedef SampleView INHERITED;
219 }; 218 };
220 219
221 ////////////////////////////////////////////////////////////////////////////// 220 //////////////////////////////////////////////////////////////////////////////
222 221
223 static SkView* MyFactory() { return new StrokePathView; } 222 static SkView* MyFactory() { return new StrokePathView; }
224 static SkViewRegister reg(MyFactory); 223 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SamplePathFuzz.cpp ('k') | samplecode/SampleTextOnPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698