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

Side by Side Diff: samplecode/SamplePath.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/SamplePatch.cpp ('k') | samplecode/SamplePathClip.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 8
9 #include "SampleCode.h" 9 #include "SampleCode.h"
10 #include "SkAnimTimer.h" 10 #include "SkAnimTimer.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 static void test_cubic2() { 52 static void test_cubic2() {
53 const char* str = "M2242 -590088L-377758 9.94099e+07L-377758 9.94099e+07L224 2 -590088Z"; 53 const char* str = "M2242 -590088L-377758 9.94099e+07L-377758 9.94099e+07L224 2 -590088Z";
54 SkPath path; 54 SkPath path;
55 SkParsePath::FromSVGString(str, &path); 55 SkParsePath::FromSVGString(str, &path);
56 56
57 { 57 {
58 #ifdef SK_BUILD_FOR_WIN 58 #ifdef SK_BUILD_FOR_WIN
59 // windows doesn't have strtof 59 // windows doesn't have strtof
60 float x = (float)strtod("9.94099e+07", NULL); 60 float x = (float)strtod("9.94099e+07", nullptr);
61 #else 61 #else
62 float x = strtof("9.94099e+07", NULL); 62 float x = strtof("9.94099e+07", nullptr);
63 #endif 63 #endif
64 int ix = (int)x; 64 int ix = (int)x;
65 int fx = (int)(x * 65536); 65 int fx = (int)(x * 65536);
66 int ffx = SkScalarToFixed(x); 66 int ffx = SkScalarToFixed(x);
67 SkDebugf("%g %x %x %x\n", x, ix, fx, ffx); 67 SkDebugf("%g %x %x %x\n", x, ix, fx, ffx);
68 68
69 SkRect r = path.getBounds(); 69 SkRect r = path.getBounds();
70 SkIRect ir; 70 SkIRect ir;
71 r.round(&ir); 71 r.round(&ir);
72 SkDebugf("[%g %g %g %g] [%x %x %x %x]\n", 72 SkDebugf("[%g %g %g %g] [%x %x %x %x]\n",
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 fStroke += fDStroke * delta; 205 fStroke += fDStroke * delta;
206 if (fStroke > fMaxStroke || fStroke < fMinStroke) { 206 if (fStroke > fMaxStroke || fStroke < fMinStroke) {
207 fDStroke = -fDStroke; 207 fDStroke = -fDStroke;
208 } 208 }
209 return true; 209 return true;
210 } 210 }
211 211
212 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride { 212 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride {
213 fShowHairline = !fShowHairline; 213 fShowHairline = !fShowHairline;
214 this->inval(NULL); 214 this->inval(nullptr);
215 return this->INHERITED::onFindClickHandler(x, y, modi); 215 return this->INHERITED::onFindClickHandler(x, y, modi);
216 } 216 }
217 217
218 private: 218 private:
219 typedef SampleView INHERITED; 219 typedef SampleView INHERITED;
220 }; 220 };
221 DEF_SAMPLE( return new PathView; ) 221 DEF_SAMPLE( return new PathView; )
222 222
223 ////////////////////////////////////////////////////////////////////////////// 223 //////////////////////////////////////////////////////////////////////////////
224 224
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 fCornerPaint.setColor(SK_ColorGREEN); 262 fCornerPaint.setColor(SK_ColorGREEN);
263 fCornerPaint.setPathEffect(SkCornerPathEffect::Create(rad*2))->unref(); 263 fCornerPaint.setPathEffect(SkCornerPathEffect::Create(rad*2))->unref();
264 264
265 fSkeletonPaint.setAntiAlias(true); 265 fSkeletonPaint.setAntiAlias(true);
266 fSkeletonPaint.setStyle(SkPaint::kStroke_Style); 266 fSkeletonPaint.setStyle(SkPaint::kStroke_Style);
267 fSkeletonPaint.setColor(SK_ColorRED); 267 fSkeletonPaint.setColor(SK_ColorRED);
268 } 268 }
269 269
270 void toggle(bool& value) { 270 void toggle(bool& value) {
271 value = !value; 271 value = !value;
272 this->inval(NULL); 272 this->inval(nullptr);
273 } 273 }
274 274
275 protected: 275 protected:
276 // overrides from SkEventSink 276 // overrides from SkEventSink
277 bool onQuery(SkEvent* evt) override { 277 bool onQuery(SkEvent* evt) override {
278 if (SampleCode::TitleQ(*evt)) { 278 if (SampleCode::TitleQ(*evt)) {
279 SampleCode::TitleR(evt, "ArcTo"); 279 SampleCode::TitleR(evt, "ArcTo");
280 return true; 280 return true;
281 } 281 }
282 SkUnichar uni; 282 SkUnichar uni;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 317
318 canvas->drawPath(path, fSkeletonPaint); 318 canvas->drawPath(path, fSkeletonPaint);
319 } 319 }
320 320
321 bool onClick(Click* click) override { 321 bool onClick(Click* click) override {
322 int32_t index; 322 int32_t index;
323 if (click->fMeta.findS32("index", &index)) { 323 if (click->fMeta.findS32("index", &index)) {
324 SkASSERT((unsigned)index < N); 324 SkASSERT((unsigned)index < N);
325 fPts[index] = click->fCurr; 325 fPts[index] = click->fCurr;
326 this->inval(NULL); 326 this->inval(nullptr);
327 return true; 327 return true;
328 } 328 }
329 return false; 329 return false;
330 } 330 }
331 331
332 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride { 332 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride {
333 const SkScalar tol = 4; 333 const SkScalar tol = 4;
334 const SkRect r = SkRect::MakeXYWH(x - tol, y - tol, tol * 2, tol * 2); 334 const SkRect r = SkRect::MakeXYWH(x - tol, y - tol, tol * 2, tol * 2);
335 for (int i = 0; i < N; ++i) { 335 for (int i = 0; i < N; ++i) {
336 if (r.intersects(SkRect::MakeXYWH(fPts[i].fX, fPts[i].fY, 1, 1))) { 336 if (r.intersects(SkRect::MakeXYWH(fPts[i].fX, fPts[i].fY, 1, 1))) {
337 Click* click = new Click(this); 337 Click* click = new Click(this);
338 click->fMeta.setS32("index", i); 338 click->fMeta.setS32("index", i);
339 return click; 339 return click;
340 } 340 }
341 } 341 }
342 return this->INHERITED::onFindClickHandler(x, y, modi); 342 return this->INHERITED::onFindClickHandler(x, y, modi);
343 } 343 }
344 344
345 private: 345 private:
346 typedef SampleView INHERITED; 346 typedef SampleView INHERITED;
347 }; 347 };
348 DEF_SAMPLE( return new ArcToView; ) 348 DEF_SAMPLE( return new ArcToView; )
349 349
OLDNEW
« no previous file with comments | « samplecode/SamplePatch.cpp ('k') | samplecode/SamplePathClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698