rewrite tricky loop to avoid -Wsizeof-array-div
I don't see anything particularly wrong with the code as written, but
it's triggering a warning from the new Clang -Wsizeof-array-div because
it _looks_ like a bug, dividing sizeof(SkPoint[2]) by sizeof(SkScalar).
(The answer is 4.)
We can rewrite this to just not trigger the warning.
See https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=36439
Bug: fuchsia:36439
Change-Id: I73bef83add9050d95b3ccf69e613ab009c6a152b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/240825
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index fd91237..b122f9d 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1431,9 +1431,9 @@
values are on integers, place the conic on integers as well.
*/
if (expectIntegers) {
- SkScalar* mappedScalars = &mapped[0].fX;
- for (unsigned index = 0; index < sizeof(mapped) / sizeof(SkScalar); ++index) {
- mappedScalars[index] = SkScalarRoundToScalar(mappedScalars[index]);
+ for (SkPoint& point : mapped) {
+ point.fX = SkScalarRoundToScalar(point.fX);
+ point.fY = SkScalarRoundToScalar(point.fY);
}
}
this->conicTo(mapped[0], mapped[1], w);