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

Side by Side Diff: gm/stringart.cpp

Issue 1135693003: Revert of Revert of stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « gm/shaderbounds.cpp ('k') | include/core/SkMatrix.h » ('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 * 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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 29 matching lines...) Expand all
40 SkScalar step = angle; 40 SkScalar step = angle;
41 41
42 SkPath path; 42 SkPath path;
43 path.moveTo(center); 43 path.moveTo(center);
44 44
45 while (length < (SkScalarHalf(size) - 10.f)) 45 while (length < (SkScalarHalf(size) - 10.f))
46 { 46 {
47 SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX, 47 SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX,
48 length*SkScalarSin(step) + center.fY); 48 length*SkScalarSin(step) + center.fY);
49 path.lineTo(rp); 49 path.lineTo(rp);
50 length += SkScalarDiv(angle, SkScalarHalf(SK_ScalarPI)); 50 length += angle / SkScalarHalf(SK_ScalarPI);
51 step += angle; 51 step += angle;
52 } 52 }
53 path.close(); 53 path.close();
54 54
55 SkPaint paint; 55 SkPaint paint;
56 paint.setAntiAlias(true); 56 paint.setAntiAlias(true);
57 paint.setStyle(SkPaint::kStroke_Style); 57 paint.setStyle(SkPaint::kStroke_Style);
58 paint.setColor(0xFF007700); 58 paint.setColor(0xFF007700);
59 59
60 canvas->drawPath(path, paint); 60 canvas->drawPath(path, paint);
61 } 61 }
62 62
63 private: 63 private:
64 typedef GM INHERITED; 64 typedef GM INHERITED;
65 }; 65 };
66 66
67 DEF_GM( return new StringArtGM; ) 67 DEF_GM( return new StringArtGM; )
OLDNEW
« no previous file with comments | « gm/shaderbounds.cpp ('k') | include/core/SkMatrix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698