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

Side by Side Diff: samplecode/SampleStrokePath.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web 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/SampleStringArt.cpp ('k') | samplecode/SampleSubpixelTranslate.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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 protected: 101 protected:
102 void onOnceBeforeDraw() SK_OVERRIDE { 102 void onOnceBeforeDraw() 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 // overrides from SkEventSink 125 // overrides from SkEventSink
126 bool onQuery(SkEvent* evt) SK_OVERRIDE { 126 bool onQuery(SkEvent* evt) override {
127 if (SampleCode::TitleQ(*evt)) { 127 if (SampleCode::TitleQ(*evt)) {
128 SampleCode::TitleR(evt, "StrokePath"); 128 SampleCode::TitleR(evt, "StrokePath");
129 return true; 129 return true;
130 } 130 }
131 return this->INHERITED::onQuery(evt); 131 return this->INHERITED::onQuery(evt);
132 } 132 }
133 133
134 SkRandom rand; 134 SkRandom rand;
135 135
136 void drawSet(SkCanvas* canvas, SkPaint* paint) { 136 void drawSet(SkCanvas* canvas, SkPaint* paint) {
137 SkAutoCanvasRestore acr(canvas, true); 137 SkAutoCanvasRestore acr(canvas, true);
138 138
139 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { 139 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
140 paint->setStyle(gRec[i].fStyle); 140 paint->setStyle(gRec[i].fStyle);
141 paint->setStrokeJoin(gRec[i].fJoin); 141 paint->setStrokeJoin(gRec[i].fJoin);
142 paint->setStrokeWidth(SkIntToScalar(gRec[i].fStrokeWidth)); 142 paint->setStrokeWidth(SkIntToScalar(gRec[i].fStrokeWidth));
143 canvas->drawPath(fPath, *paint); 143 canvas->drawPath(fPath, *paint);
144 canvas->translate(fWidth * 5 / 4, 0); 144 canvas->translate(fWidth * 5 / 4, 0);
145 } 145 }
146 } 146 }
147 147
148 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 148 void onDrawContent(SkCanvas* canvas) override {
149 test_huge_stroke(canvas); return; 149 test_huge_stroke(canvas); return;
150 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); 150 canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
151 151
152 SkPaint paint; 152 SkPaint paint;
153 paint.setAntiAlias(true); 153 paint.setAntiAlias(true);
154 154
155 if (true) { 155 if (true) {
156 canvas->drawColor(SK_ColorBLACK); 156 canvas->drawColor(SK_ColorBLACK);
157 157
158 paint.setTextSize(24); 158 paint.setTextSize(24);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 fPath.setFillType(SkPath::kWinding_FillType); 203 fPath.setFillType(SkPath::kWinding_FillType);
204 drawSet(canvas, &paint); 204 drawSet(canvas, &paint);
205 205
206 canvas->translate(0, fPath.getBounds().height() * 5 / 4); 206 canvas->translate(0, fPath.getBounds().height() * 5 / 4);
207 fPath.setFillType(SkPath::kEvenOdd_FillType); 207 fPath.setFillType(SkPath::kEvenOdd_FillType);
208 drawSet(canvas, &paint); 208 drawSet(canvas, &paint);
209 } 209 }
210 210
211 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, 211 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
212 unsigned modi) SK_OVERRIDE { 212 unsigned modi) override {
213 this->inval(NULL); 213 this->inval(NULL);
214 return this->INHERITED::onFindClickHandler(x, y, modi); 214 return this->INHERITED::onFindClickHandler(x, y, modi);
215 } 215 }
216 private: 216 private:
217 typedef SampleView INHERITED; 217 typedef SampleView INHERITED;
218 }; 218 };
219 219
220 ////////////////////////////////////////////////////////////////////////////// 220 //////////////////////////////////////////////////////////////////////////////
221 221
222 static SkView* MyFactory() { return new StrokePathView; } 222 static SkView* MyFactory() { return new StrokePathView; }
223 static SkViewRegister reg(MyFactory); 223 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleStringArt.cpp ('k') | samplecode/SampleSubpixelTranslate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698