Line::compute_bounding_box () const
{
Rect bbox;
-
+
bbox.x0 = min (_points[0].x, _points[1].x);
bbox.y0 = min (_points[0].y, _points[1].y);
bbox.x1 = max (_points[0].x, _points[1].x);
if (_outline_width <= 1.0) {
/* See Cairo FAQ on single pixel lines to understand why we add 0.5
*/
-
+
const Duple half_a_pixel (0.5, 0.5);
p0 = p0.translate (half_a_pixel);
p1 = p1.translate (half_a_pixel);
{
if (a != _points[0] || b != _points[1]) {
begin_change ();
-
+
_points[0] = a;
_points[1] = b;
-
+
_bounding_box_dirty = true;
end_change ();
}
{
if (x0 != _points[0].x || x1 != _points[1].x) {
begin_change ();
-
+
_points[0].x = x0;
_points[1].x = x1;
-
+
_bounding_box_dirty = true;
end_change ();
}
-}
+}
void
Line::set_x0 (Coord x0)
{
if (x0 != _points[0].x) {
begin_change ();
-
+
_points[0].x = x0;
-
+
_bounding_box_dirty = true;
end_change ();
}
{
if (y0 != _points[0].y) {
begin_change ();
-
+
_points[0].y = y0;
-
+
_bounding_box_dirty = true;
end_change ();
}
{
if (x1 != _points[1].x) {
begin_change ();
-
+
_points[1].x = x1;
-
+
_bounding_box_dirty = true;
end_change ();
}
{
if (y1 != _points[1].y) {
begin_change ();
-
+
_points[1].y = y1;
-
+
_bounding_box_dirty = true;
end_change ();
}