aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-05-15 13:35:35 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-16 12:59:11 +0000
commit23e474cb7331c5d2389d97dce2d9e5c93c58f39f (patch)
tree95314f82ba240a5e5f5891d78489b2f4c9364b76 /gm
parent03d1e59bdac65cc1dd606b60e6565eb6860419f9 (diff)
SkCanvas: Helpers for draw{Point,Line,Circle}
Change-Id: Ie9c7d3b8f01aee435563b23b7d27f098f07dd287 Reviewed-on: https://skia-review.googlesource.com/16909 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'gm')
-rw-r--r--gm/addarc.cpp2
-rw-r--r--gm/beziereffects.cpp14
-rw-r--r--gm/circles.cpp2
-rw-r--r--gm/conicpaths.cpp4
-rw-r--r--gm/dstreadshuffle.cpp2
-rw-r--r--gm/imagescalealigned.cpp2
6 files changed, 13 insertions, 13 deletions
diff --git a/gm/addarc.cpp b/gm/addarc.cpp
index 96ac666d28..763135fac5 100644
--- a/gm/addarc.cpp
+++ b/gm/addarc.cpp
@@ -103,7 +103,7 @@ protected:
SkScalar arcLen = rad * R;
SkPoint pos;
if (meas.getPosTan(arcLen, &pos, nullptr)) {
- canvas->drawLine(0, 0, pos.x(), pos.y(), measPaint);
+ canvas->drawLine({0, 0}, pos, measPaint);
}
}
}
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index c67018d2af..d3f1965d4f 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -160,9 +160,9 @@ protected:
SkPaint ctrlPtPaint;
ctrlPtPaint.setColor(rand.nextU() | 0xFF000000);
- canvas->drawCircle(controlPts[0].fX, controlPts[0].fY, 8.f, ctrlPtPaint);
+ canvas->drawCircle(controlPts[0], 8.f, ctrlPtPaint);
for (int i = 1; i < 4; ++i) {
- canvas->drawCircle(controlPts[i].fX, controlPts[i].fY, 6.f, ctrlPtPaint);
+ canvas->drawCircle(controlPts[i], 6.f, ctrlPtPaint);
}
SkPaint polyPaint;
@@ -178,7 +178,7 @@ protected:
SkPoint* pts = chopped + 3 * c;
for (int i = 0; i < 4; ++i) {
- canvas->drawCircle(pts[i].fX, pts[i].fY, 3.f, choppedPtPaint);
+ canvas->drawCircle(pts[i], 3.f, choppedPtPaint);
}
SkRect bounds;
@@ -299,7 +299,7 @@ protected:
SkPaint ctrlPtPaint;
ctrlPtPaint.setColor(rand.nextU() | 0xFF000000);
for (int i = 0; i < 3; ++i) {
- canvas->drawCircle(controlPts[i].fX, controlPts[i].fY, 6.f, ctrlPtPaint);
+ canvas->drawCircle(controlPts[i], 6.f, ctrlPtPaint);
}
SkPaint polyPaint;
@@ -314,7 +314,7 @@ protected:
for (int c = 0; c < cnt; ++c) {
SkPoint* pts = dst[c].fPts;
for (int i = 0; i < 3; ++i) {
- canvas->drawCircle(pts[i].fX, pts[i].fY, 3.f, choppedPtPaint);
+ canvas->drawCircle(pts[i], 3.f, choppedPtPaint);
}
SkRect bounds;
@@ -516,7 +516,7 @@ protected:
SkPaint ctrlPtPaint;
ctrlPtPaint.setColor(rand.nextU() | 0xFF000000);
for (int i = 0; i < 3; ++i) {
- canvas->drawCircle(controlPts[i].fX, controlPts[i].fY, 6.f, ctrlPtPaint);
+ canvas->drawCircle(controlPts[i], 6.f, ctrlPtPaint);
}
SkPaint polyPaint;
@@ -532,7 +532,7 @@ protected:
SkPoint* pts = chopped + 2 * c;
for (int i = 0; i < 3; ++i) {
- canvas->drawCircle(pts[i].fX, pts[i].fY, 3.f, choppedPtPaint);
+ canvas->drawCircle(pts[i], 3.f, choppedPtPaint);
}
SkRect bounds;
diff --git a/gm/circles.cpp b/gm/circles.cpp
index 5c53fe2b0e..9d2eca5ba7 100644
--- a/gm/circles.cpp
+++ b/gm/circles.cpp
@@ -150,7 +150,7 @@ protected:
SkPaint giantPaint;
giantPaint.setAntiAlias(true);
giantPaint.setColor(0x80808080);
- canvas->drawCircle(giantCenter.fX, giantCenter.fY, giantRadius, giantPaint);
+ canvas->drawCircle(giantCenter, giantRadius, giantPaint);
SkRandom rand;
canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
diff --git a/gm/conicpaths.cpp b/gm/conicpaths.cpp
index d0c6a9fc5d..e0a775a9dd 100644
--- a/gm/conicpaths.cpp
+++ b/gm/conicpaths.cpp
@@ -140,7 +140,7 @@ DEF_SIMPLE_GM(arccirclegap, canvas, 250, 250) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
- canvas->drawCircle(c.fX, c.fY, radius, paint);
+ canvas->drawCircle(c, radius, paint);
SkPath path;
path.moveTo(288.88884710654133f, -280.26680862609f);
path.arcTo(0, 0, -39.00216443306411f, 400.6058925796476f, radius);
@@ -156,7 +156,7 @@ DEF_SIMPLE_GM(largecircle, canvas, 250, 250) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
- canvas->drawCircle(c.fX, c.fY, radius, paint);
+ canvas->drawCircle(c, radius, paint);
}
DEF_SIMPLE_GM(crbug_640176, canvas, 250, 250) {
diff --git a/gm/dstreadshuffle.cpp b/gm/dstreadshuffle.cpp
index 3385ae4a69..aaef61d63c 100644
--- a/gm/dstreadshuffle.cpp
+++ b/gm/dstreadshuffle.cpp
@@ -115,7 +115,7 @@ protected:
rot.postTranslate(3.f, 0);
for (int i = 0; i < 12; ++i) {
hairPaint.setColor(GetColor(&colorRandom));
- canvas->drawLine(pts[0].fX, pts[0].fY, pts[1].fX, pts[1].fY, hairPaint);
+ canvas->drawLine(pts[0], pts[1], hairPaint);
rot.mapPoints(pts, 2);
}
}
diff --git a/gm/imagescalealigned.cpp b/gm/imagescalealigned.cpp
index 3d74f0edf8..a1f67410f1 100644
--- a/gm/imagescalealigned.cpp
+++ b/gm/imagescalealigned.cpp
@@ -84,7 +84,7 @@ private:
surface->getCanvas()->drawRect(border, paint);
paint.setColor(SK_ColorBLACK);
- surface->getCanvas()->drawLine(start.x(), start.y(), end.x(), end.y(), paint);
+ surface->getCanvas()->drawLine(start, end, paint);
paint.reset();
paint.setColor(color);