From 25f00397565bbdce7d7e98420f1921afd5b5092a Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 18 May 2019 21:14:16 +0200 Subject: More pixel-level alignment fixes for various controls, by making all controls have an odd-integer size (measured in pixels) --- src/display/sodipodi-ctrl.cpp | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'src/display/sodipodi-ctrl.cpp') diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index 601d99e1c..a48ec4cd8 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -254,15 +254,8 @@ sp_ctrl_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int fla if (!ctrl->defined) return; - int w = (ctrl->width + 1); - int h = (ctrl->height + 1); - if ((ctrl->shape == SP_CTRL_SHAPE_BITMAP) or (ctrl->shape == SP_CTRL_SHAPE_IMAGE)) { - w = ctrl->width; - h = ctrl->height; - } - int w_half = floor(w/2.0); - int h_half = floor(h/2.0); - + int w_half = floor(ctrl->width/2.0); + int h_half = floor(ctrl->height/2.0); int x = floor(affine[4]) - w_half; int y = floor(affine[5]) - h_half; @@ -361,12 +354,8 @@ sp_ctrl_build_cache (SPCtrl *ctrl, int device_scale) stroke_color = fill_color; } - gint width = (ctrl->width + 1) * device_scale; - gint height = (ctrl->height + 1) * device_scale; - if ((ctrl->shape == SP_CTRL_SHAPE_BITMAP) or (ctrl->shape == SP_CTRL_SHAPE_IMAGE)) { - width = ctrl->width * device_scale; - height = ctrl->height * device_scale; - } + gint width = ctrl->width * device_scale; + gint height = ctrl->height * device_scale; if (width < 2) return; gint size = width * height; @@ -611,12 +600,9 @@ sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf) } // Must match width/height sp_ctrl_build_cache. - int w = (ctrl->width + 1) * buf->device_scale; - int h = (ctrl->height + 1) * buf->device_scale; - if ((ctrl->shape == SP_CTRL_SHAPE_BITMAP) or (ctrl->shape == SP_CTRL_SHAPE_IMAGE)) { - w = ctrl->width * buf->device_scale; - h = ctrl->height * buf->device_scale; - } + int w = ctrl->width * buf->device_scale; + int h = ctrl->height * buf->device_scale; + double x = ctrl->box.left() - buf->rect.left(); double y = ctrl->box.top() - buf->rect.top(); -- cgit v1.2.3