diff options
author | Herb Derby <herb@google.com> | 2022-09-22 15:50:42 -0400 |
---|---|---|
committer | SkCQ <skcq-be@skia-corp.google.com.iam.gserviceaccount.com> | 2022-09-23 15:57:21 +0000 |
commit | 161a80f8e8c334d7deb3decf951971562047d75c (patch) | |
tree | 4b791c8b8d3fb84880f1a11afbe1ce2f9c981679 /bench/PolyUtilsBench.cpp | |
parent | b8a61c878b5daaa830af10cc5504e2f83cb2fcef (diff) | |
download | skia-161a80f8e8c334d7deb3decf951971562047d75c.tar.gz |
Reduce work a-like calls in SkTDArray
Three calls are removed:
top -> back
array -> data
push -> append
Change-Id: Ifa178b7f5a3f509ab9133af3b13bc27037255964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/583957
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Diffstat (limited to 'bench/PolyUtilsBench.cpp')
-rw-r--r-- | bench/PolyUtilsBench.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bench/PolyUtilsBench.cpp b/bench/PolyUtilsBench.cpp index 5aca9a258d..2a8c3ef0a0 100644 --- a/bench/PolyUtilsBench.cpp +++ b/bench/PolyUtilsBench.cpp @@ -123,9 +123,9 @@ public: SkScalar rad = 0; const SkScalar drad = SK_ScalarPI / n; for (int i = 0; i < n; i++) { - *poly->push() = SkPoint::Make(c + SkScalarCos(rad) * r1, c + SkScalarSin(rad) * r1); + *poly->append() = SkPoint::Make(c + SkScalarCos(rad) * r1, c + SkScalarSin(rad) * r1); rad += drad; - *poly->push() = SkPoint::Make(c + SkScalarCos(rad) * r2, c + SkScalarSin(rad) * r2); + *poly->append() = SkPoint::Make(c + SkScalarCos(rad) * r2, c + SkScalarSin(rad) * r2); rad += drad; } } @@ -148,7 +148,7 @@ public: SkScalar rad = 0; const SkScalar drad = 2 * SK_ScalarPI / n; for (int i = 0; i < n; i++) { - *poly->push() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); + *poly->append() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); rad += drad; } } @@ -171,10 +171,10 @@ public: SkScalar rad = -SK_ScalarPI / 2; const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n; - *poly->push() = SkPoint::Make(c, c - r); + *poly->append() = SkPoint::Make(c, c - r); for (int i = 1; i < n; i++) { rad += drad; - *poly->push() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); + *poly->append() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); } } private: @@ -197,11 +197,11 @@ public: SkScalar rad = 0; const SkScalar drad = 3 * SK_ScalarPI / (2*n); for (int i = 0; i < n; i++) { - *poly->push() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); + *poly->append() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); rad += drad; } // and the mouth - *poly->push() = SkPoint::Make(45, 45); + *poly->append() = SkPoint::Make(45, 45); } private: using INHERITED = PolyUtilsBench; @@ -222,11 +222,11 @@ public: SkScalar rad = 0; const SkScalar drad = 3 * SK_ScalarPI / (2*n); for (int i = 0; i < n; i++) { - *poly->push() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); + *poly->append() = SkPoint::Make(c + SkScalarCos(rad) * r, c + SkScalarSin(rad) * r); rad += drad; } // and the tip of the cone - *poly->push() = SkPoint::Make(90, 0); + *poly->append() = SkPoint::Make(90, 0); } private: using INHERITED = PolyUtilsBench; |