Fix the issue with filling the ellipse

This is a port of PR #3447 (which is already applied to 2.4 branch).