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>
This commit is contained in:
Mike Klein 2019-09-11 17:11:19 -07:00 committed by Skia Commit-Bot
parent 429f0d380c
commit a424536401

View File

@ -1431,9 +1431,9 @@ SkPath& SkPath::arcTo(SkScalar rx, SkScalar ry, SkScalar angle, SkPath::ArcSize
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);