LibGfx: initialize winding number to 1 for NonZero winding rules

Since we first check the winding number and only then update it, fills
for "Rectangle-like" (made up of 2 parallel segments) paths would draw
nothing when filled by NonZero winding rules. (Fix by alimpfard)
This commit is contained in:
Idan Horowitz 2021-04-14 23:18:49 +03:00 committed by Andreas Kling
parent d96354f58e
commit b7c3f046f7
Notes: sideshowbarker 2024-07-18 20:20:13 +09:00

View File

@ -1696,7 +1696,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
#endif #endif
if (active_list.size() > 1) { if (active_list.size() > 1) {
auto winding_number { 0 }; auto winding_number { winding_rule == WindingRule::Nonzero ? 1 : 0 };
for (size_t i = 1; i < active_list.size(); ++i) { for (size_t i = 1; i < active_list.size(); ++i) {
auto& previous = active_list[i - 1]; auto& previous = active_list[i - 1];
auto& current = active_list[i]; auto& current = active_list[i];