From 536bceae2dd6a33168fb41511d5263b697d2d32f Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 31 Jan 2008 15:03:00 +0000 Subject: [PATCH] Ensure that the size we draw is a whole number of pixels in each dimension, and prevent zooming out too far from creating canvases so small they contain no pixels at all. git-svn-id: http://svn.voria.com/code@1537 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/workarea.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/synfig-studio/trunk/src/gtkmm/workarea.cpp b/synfig-studio/trunk/src/gtkmm/workarea.cpp index 1b61346..72acd90 100644 --- a/synfig-studio/trunk/src/gtkmm/workarea.cpp +++ b/synfig-studio/trunk/src/gtkmm/workarea.cpp @@ -2256,6 +2256,13 @@ studio::WorkArea::async_update_preview() int w=(int)(desc.get_w()*zoom); int h=(int)(desc.get_h()*zoom); + // ensure that the size we draw is a whole number of pixels in each dimension + if (low_resolution) + { + if (w % low_res_pixel_size) w = (w/low_res_pixel_size+1)*low_res_pixel_size; + if (h % low_res_pixel_size) h = (h/low_res_pixel_size+1)*low_res_pixel_size; + } + // Setup the description parameters desc.set_antialias(1); desc.set_time(cur_time); -- 2.7.4