The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

HiDPI for label tools

These changes was commited to the Birdfont repository Mon, 19 Sep 2016 19:42:45 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 19 Sep 2016 19:42:45 +0000 (21:42 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 19 Sep 2016 19:42:45 +0000 (21:42 +0200)
commit 0803deef2826ff693a51b865740166ba3ebff882
tree 8d33e38e2bb69cc3d8420404484783046f35806f
parent 6c3def2a7987ffae855109b0d414893242ec7670
HiDPI for label tools

libbirdfont/LabelTool.vala
--- a/libbirdfont/LabelTool.vala +++ b/libbirdfont/LabelTool.vala @@ -91,29 +91,31 @@ if (is_selected ()) { if (selected_cache == null) { - selected_cache = Screen.create_background_surface ((int) w, (int) h + 2); + selected_cache = Screen.create_background_surface ((int) (w * Screen.get_scale ()), (int) ((h + 2) * Screen.get_scale ())); Context c = new Context ((!) selected_cache); - c.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ()); + c.scale (Screen.get_scale (), Screen.get_scale ()); draw_tool_surface (c, x, 2, true); } cr.save (); + cr.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ()); cr.set_antialias (Cairo.Antialias.NONE); - cr.set_source_surface ((!) selected_cache, 0, (int) y - 2); + cr.set_source_surface ((!) selected_cache, 0, (int) ((y - 2) * Screen.get_scale ())); cr.paint (); cr.restore (); } else { if (deselected_cache == null) { - deselected_cache = Screen.create_background_surface ((int) w, (int) h + 2); + deselected_cache = Screen.create_background_surface ((int) (w * Screen.get_scale ()), (int) ((h + 2) * Screen.get_scale ())); Context c = new Context ((!) deselected_cache); - c.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ()); + c.scale (Screen.get_scale (), Screen.get_scale ()); draw_tool_surface (c, x, 2, false); } cr.save (); + cr.scale (1 / Screen.get_scale (), 1 / Screen.get_scale ()); cr.set_antialias (Cairo.Antialias.NONE); - cr.set_source_surface ((!) deselected_cache, 0, (int) y - 2); + cr.set_source_surface ((!) deselected_cache, 0, (int) ((y - 2) * Screen.get_scale ())); cr.paint (); cr.restore (); }