Fix off-by-one/one positioning by GeoPainter::drawEllipse/Rectangle

Authored by kossebau on Jul 12 2016, 3:17 AM.

Description

Fix off-by-one/one positioning by GeoPainter::drawEllipse/Rectangle

Summary:
GeoPainter::drawEllipse() & GeoPainter::drawRect() both take the
parameters width & height as qreal type, but if !isGeoProjected they do the
actual rendering calls using int based coordinates & sizes.

The old calculation would not compensate qreal->int rounding changes and often result
in a wrong 1 pixel offset in direction of topleft corner.

The respective GeoPainter::regionFromEllipse() and GeoPainter::regionFromRect()
also are adapted, with the first also being fixed to take also strokeWidth
into account for the topleft corner calculation, like done with the rect.

Test Plan: Extended geopainter example app renders rectangles and ellipses as expected.

Reviewers: nienhueser, rahn, Marble

Reviewed By: rahn, Marble

Differential Revision: https://phabricator.kde.org/D2141

Details

Committed
kossebauJul 12 2016, 11:49 AM
Reviewer
Marble
Differential Revision
D2141: Fix off-by-one/one positioning by GeoPainter::drawEllipse/Rectangle
Parents
R34:8b37d1eae4d7: remove unused include
Branches
Unknown
Tags
Unknown