13
0

Fix canvas rectangle bounding box

When drawing the outline of a rectangle, the bounding
box must cover the whole pixel of the line. Otherwise
the line would be left behind when the rectangle shrinks.
This commit is contained in:
Robin Gareus 2023-09-07 02:42:25 +02:00
parent cc47b5fe3c
commit e88a121ff8
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -170,9 +170,12 @@ Rectangle::size_request (double& w, double& h) const
void
Rectangle::compute_bounding_box () const
{
if (!_rect.empty()) {
// _bounding_box = _rect.fix().expand (1.0 + _outline_width * 0.5);
_bounding_box = _rect.fix().expand (_outline_width * 0.5);
if (_rect.empty ()) {
_bounding_box = Rect ();
} else if (_outline && _outline_width && _outline_what) {
_bounding_box = _rect.fix().expand (ceil (_outline_width * 0.5));
} else {
_bounding_box = _rect.fix();
}
set_bbox_clean ();