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

Side by Side Diff: samplecode/SampleDither.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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 | « samplecode/SampleDegenerateTwoPtRadials.cpp ('k') | samplecode/SampleEffects.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 "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 r.inset(p.getStrokeWidth(), p.getStrokeWidth()); 48 r.inset(p.getStrokeWidth(), p.getStrokeWidth());
49 SkRect innerBounds = r; 49 SkRect innerBounds = r;
50 50
51 if (true) { 51 if (true) {
52 c->drawOval(r, p); 52 c->drawOval(r, p);
53 } else { 53 } else {
54 SkScalar x = r.centerX(); 54 SkScalar x = r.centerX();
55 SkScalar y = r.centerY(); 55 SkScalar y = r.centerY();
56 SkScalar radius = r.width() / 2; 56 SkScalar radius = r.width() / 2;
57 SkScalar thickness = p.getStrokeWidth(); 57 SkScalar thickness = p.getStrokeWidth();
58 SkScalar sweep = SkFloatToScalar(360.0f); 58 SkScalar sweep = 360.0f;
59 SkPath path; 59 SkPath path;
60 60
61 path.moveTo(x + radius, y); 61 path.moveTo(x + radius, y);
62 // outer top 62 // outer top
63 path.lineTo(x + radius + thickness, y); 63 path.lineTo(x + radius + thickness, y);
64 // outer arc 64 // outer arc
65 path.arcTo(bounds, 0, sweep, false); 65 path.arcTo(bounds, 0, sweep, false);
66 // inner arc 66 // inner arc
67 path.arcTo(innerBounds, sweep, -sweep, false); 67 path.arcTo(innerBounds, sweep, -sweep, false);
68 path.close(); 68 path.close();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 176
177 private: 177 private:
178 typedef SampleView INHERITED; 178 typedef SampleView INHERITED;
179 }; 179 };
180 180
181 ////////////////////////////////////////////////////////////////////////////// 181 //////////////////////////////////////////////////////////////////////////////
182 182
183 static SkView* MyFactory() { return new DitherView; } 183 static SkView* MyFactory() { return new DitherView; }
184 static SkViewRegister reg(MyFactory); 184 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleDegenerateTwoPtRadials.cpp ('k') | samplecode/SampleEffects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698