| Summary: | Potential Assertion Fix - newStartAngle >= 0 && newStartAngle < twoPiFloat | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Canvas | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | dino, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
|
Description
Ahmad Saleem
2023-01-10 07:07:11 PST
This compiles:
tatic void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise)
{
float newStartAngle = fmodf(startAngle, (2 * piFloat));
if (newStartAngle < 0)
newStartAngle += (2 * piFloat);
If we add this:
constexpr auto twoPiFloat = 2 * piFloat;
we can simplify whole function:
static void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise)
{
constexpr auto twoPiFloat = 2 * piFloat;
float newStartAngle = fmodf(startAngle, twoPiFloat);
if (newStartAngle < 0)
newStartAngle += twoPiFloat;
float delta = newStartAngle - startAngle;
startAngle = newStartAngle;
endAngle = endAngle + delta;
ASSERT(newStartAngle >= 0 && (newStartAngle < twoPiFloat || WTF::areEssentiallyEqual<float>(newStartAngle, twoPiFloat)));
if (anticlockwise && startAngle - endAngle >= twoPiFloat)
endAngle = startAngle - twoPiFloat;
else if (!anticlockwise && endAngle - startAngle >= twoPiFloat)
endAngle = startAngle + twoPiFloat;
}
PR attempt - https://github.com/WebKit/WebKit/pull/19657 Committed 269925@main (34e0f2e73041): <https://commits.webkit.org/269925@main> Reviewed commits have been landed. Closing PR #19657 and removing active labels. |