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

Unified Diff: samplecode/SampleArc.cpp

Issue 869843006: more gms for conics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/addarc.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleArc.cpp
diff --git a/samplecode/SampleArc.cpp b/samplecode/SampleArc.cpp
index bc20e92cc326ab1d4a03c9c20dc0449c849e9a7b..710901bddffb66d10f85b49d35ebc9e5c6b0001d 100644
--- a/samplecode/SampleArc.cpp
+++ b/samplecode/SampleArc.cpp
@@ -122,8 +122,7 @@ protected:
canvas->drawLine(r.centerX(), r.fTop, r.centerX(), r.fBottom, p);
}
- static void DrawLabel(SkCanvas* canvas, const SkRect& rect,
- int start, int sweep) {
+ static void DrawLabel(SkCanvas* canvas, const SkRect& rect, SkScalar start, SkScalar sweep) {
SkPaint paint;
paint.setAntiAlias(true);
@@ -131,9 +130,9 @@ protected:
SkString str;
- str.appendS32(start);
+ str.appendScalar(start);
str.append(", ");
- str.appendS32(sweep);
+ str.appendScalar(sweep);
canvas->drawText(str.c_str(), str.size(), rect.centerX(),
rect.fBottom + paint.getTextSize() * 5/4, paint);
}
@@ -141,8 +140,8 @@ protected:
static void DrawArcs(SkCanvas* canvas) {
SkPaint paint;
SkRect r;
- SkScalar w = SkIntToScalar(75);
- SkScalar h = SkIntToScalar(50);
+ SkScalar w = 75;
+ SkScalar h = 50;
r.set(0, 0, w, h);
paint.setAntiAlias(true);
@@ -153,7 +152,7 @@ protected:
paint.setStrokeWidth(SkIntToScalar(1));
- static const int gAngles[] = {
+ static const SkScalar gAngles[] = {
0, 360,
0, 45,
0, -45,
@@ -170,8 +169,7 @@ protected:
DrawRectWithLines(canvas, r, paint);
paint.setColor(SK_ColorRED);
- canvas->drawArc(r, SkIntToScalar(gAngles[i]),
- SkIntToScalar(gAngles[i+1]), false, paint);
+ canvas->drawArc(r, gAngles[i], gAngles[i+1], false, paint);
DrawLabel(canvas, r, gAngles[i], gAngles[i+1]);
« no previous file with comments | « gm/addarc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698