diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2019-05-18 19:14:16 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mail@diedenrezi.nl> | 2019-05-20 16:22:27 +0000 |
| commit | 25f00397565bbdce7d7e98420f1921afd5b5092a (patch) | |
| tree | eb911793c46904938c43c26d789c6a3b12c2347f /src/display/sodipodi-ctrl.cpp | |
| parent | Another pixel alignment fix (diff) | |
| download | inkscape-25f00397565bbdce7d7e98420f1921afd5b5092a.tar.gz inkscape-25f00397565bbdce7d7e98420f1921afd5b5092a.zip | |
More pixel-level alignment fixes for various controls, by making all controls have an odd-integer size (measured in pixels)
Diffstat (limited to 'src/display/sodipodi-ctrl.cpp')
| -rw-r--r-- | src/display/sodipodi-ctrl.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
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(); |
