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

Side by Side Diff: samplecode/SampleStringArt.cpp

Issue 24258003: Type warning fix for: Add string art GM and sample. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Missing nit Created 7 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 | Annotate | Revision Log
« no previous file with comments | « gm/stringart.cpp ('k') | no next file » | 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 9
10 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014 10 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014
(...skipping 19 matching lines...) Expand all
30 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 30 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
31 SkScalar angle = fAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI); 31 SkScalar angle = fAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI);
32 32
33 SkPoint center = SkPoint::Make(SkScalarHalf(this->width()), SkScalarHalf (this->height())); 33 SkPoint center = SkPoint::Make(SkScalarHalf(this->width()), SkScalarHalf (this->height()));
34 SkScalar length = 5; 34 SkScalar length = 5;
35 SkScalar step = angle; 35 SkScalar step = angle;
36 36
37 SkPath path; 37 SkPath path;
38 path.moveTo(center); 38 path.moveTo(center);
39 39
40 while (length < (SkScalarHalf(SkMin32(this->width(), this->height())) - 10.f)) 40 while (length < (SkScalarHalf(SkMinScalar(this->width(), this->height()) ) - 10.f))
41 { 41 {
42 SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX, 42 SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX,
43 length*SkScalarSin(step) + center.fY); 43 length*SkScalarSin(step) + center.fY);
44 path.lineTo(rp); 44 path.lineTo(rp);
45 length += SkScalarDiv(angle, SkScalarHalf(SK_ScalarPI)); 45 length += SkScalarDiv(angle, SkScalarHalf(SK_ScalarPI));
46 step += angle; 46 step += angle;
47 } 47 }
48 path.close(); 48 path.close();
49 49
50 SkPaint paint; 50 SkPaint paint;
(...skipping 12 matching lines...) Expand all
63 private: 63 private:
64 64
65 SkScalar fAngle; 65 SkScalar fAngle;
66 typedef SampleView INHERITED; 66 typedef SampleView INHERITED;
67 }; 67 };
68 68
69 ////////////////////////////////////////////////////////////////////////////// 69 //////////////////////////////////////////////////////////////////////////////
70 70
71 static SkView* MyFactory() { return new StringArtView; } 71 static SkView* MyFactory() { return new StringArtView; }
72 static SkViewRegister reg(MyFactory); 72 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/stringart.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698