Change the tile size from 128 to 120 and allow all the factors of 120 to be used...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Thu, 31 Jan 2008 14:12:58 +0000 (14:12 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Thu, 31 Jan 2008 14:12:58 +0000 (14:12 +0000)
git-svn-id: http://svn.voria.com/code@1534 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/target_tile.h
synfig-studio/trunk/src/gtkmm/app.cpp
synfig-studio/trunk/src/gtkmm/canvasview.cpp
synfig-studio/trunk/src/gtkmm/canvasview.h
synfig-studio/trunk/src/gtkmm/renderer_canvas.cpp
synfig-studio/trunk/src/gtkmm/workarea.cpp
synfig-studio/trunk/src/gtkmm/workarea.h

index 8f5bf54..7ba4ad7 100644 (file)
@@ -31,7 +31,7 @@
 
 /* === M A C R O S ========================================================= */
 
-#define TILE_SIZE 128
+#define TILE_SIZE 120
 
 /* === T Y P E D E F S ===================================================== */
 
index 8195891..6c185a4 100644 (file)
@@ -639,12 +639,21 @@ init_ui_manager()
        DEFINE_ACTION("quality-08", _("Use Quality Level 8"));
        DEFINE_ACTION("quality-09", _("Use Quality Level 9"));
        DEFINE_ACTION("quality-10", _("Use Quality Level 10"));
-       DEFINE_ACTION("lowres-pixel-01", _("Set Low-Res pixel size to 2^1"));
-       DEFINE_ACTION("lowres-pixel-02", _("Set Low-Res pixel size to 2^2"));
-       DEFINE_ACTION("lowres-pixel-03", _("Set Low-Res pixel size to 2^3"));
-       DEFINE_ACTION("lowres-pixel-04", _("Set Low-Res pixel size to 2^4"));
-       DEFINE_ACTION("lowres-pixel-05", _("Set Low-Res pixel size to 2^5"));
-       DEFINE_ACTION("lowres-pixel-06", _("Set Low-Res pixel size to 2^6"));
+       DEFINE_ACTION("lowres-pixel-2", _("Set Low-Res pixel size to 2"));
+       DEFINE_ACTION("lowres-pixel-3", _("Set Low-Res pixel size to 3"));
+       DEFINE_ACTION("lowres-pixel-4", _("Set Low-Res pixel size to 4"));
+       DEFINE_ACTION("lowres-pixel-5", _("Set Low-Res pixel size to 5"));
+       DEFINE_ACTION("lowres-pixel-6", _("Set Low-Res pixel size to 6"));
+       DEFINE_ACTION("lowres-pixel-8", _("Set Low-Res pixel size to 8"));
+       DEFINE_ACTION("lowres-pixel-10", _("Set Low-Res pixel size to 10"));
+       DEFINE_ACTION("lowres-pixel-12", _("Set Low-Res pixel size to 12"));
+       DEFINE_ACTION("lowres-pixel-15", _("Set Low-Res pixel size to 15"));
+       DEFINE_ACTION("lowres-pixel-20", _("Set Low-Res pixel size to 20"));
+       DEFINE_ACTION("lowres-pixel-24", _("Set Low-Res pixel size to 24"));
+       DEFINE_ACTION("lowres-pixel-30", _("Set Low-Res pixel size to 30"));
+       DEFINE_ACTION("lowres-pixel-40", _("Set Low-Res pixel size to 40"));
+       DEFINE_ACTION("lowres-pixel-60", _("Set Low-Res pixel size to 60"));
+       DEFINE_ACTION("lowres-pixel-120", _("Set Low-Res pixel size to 120"));
        DEFINE_ACTION("play", _("Play"));
        // DEFINE_ACTION("pause", _("Pause"));
        DEFINE_ACTION("stop", _("Stop"));
@@ -777,12 +786,21 @@ init_ui_manager()
 "                      <menuitem action='quality-10' />"
 "              </menu>"
 "              <menu action='menu-lowres-pixel'>"
-"                      <menuitem action='lowres-pixel-01' />"
-"                      <menuitem action='lowres-pixel-02' />"
-"                      <menuitem action='lowres-pixel-03' />"
-"                      <menuitem action='lowres-pixel-04' />"
-"                      <menuitem action='lowres-pixel-05' />"
-"                      <menuitem action='lowres-pixel-06' />"
+"                      <menuitem action='lowres-pixel-2' />"
+"                      <menuitem action='lowres-pixel-3' />"
+"                      <menuitem action='lowres-pixel-4' />"
+"                      <menuitem action='lowres-pixel-5' />"
+"                      <menuitem action='lowres-pixel-6' />"
+"                      <menuitem action='lowres-pixel-8' />"
+"                      <menuitem action='lowres-pixel-10' />"
+"                      <menuitem action='lowres-pixel-12' />"
+"                      <menuitem action='lowres-pixel-15' />"
+"                      <menuitem action='lowres-pixel-20' />"
+"                      <menuitem action='lowres-pixel-24' />"
+"                      <menuitem action='lowres-pixel-30' />"
+"                      <menuitem action='lowres-pixel-40' />"
+"                      <menuitem action='lowres-pixel-60' />"
+"                      <menuitem action='lowres-pixel-120' />"
 "              </menu>"
 "              <separator name='bleh08'/>"
 "              <menuitem action='play'/>"
index e9fe579..eb9795b 100644 (file)
@@ -1290,21 +1290,26 @@ CanvasView::init_menus()
                }
        }
 
+       // prime factors of 120 are 2, 2, 2, 3, 5
+       int pixel_size_array[] = {2,3,4,5,6,8,10,12,15,20,24,30,40,60,120};
+       list<int> pixel_sizes(pixel_size_array, pixel_size_array + sizeof(pixel_size_array) / sizeof(int));
+
        // Low-Res Quality Menu
        {
                int i;
-               for(i=1;i<=6;i++)
+               for(list<int>::iterator iter = pixel_sizes.begin(); iter != pixel_sizes.end(); iter++)
                {
-                       Glib::RefPtr<Gtk::RadioAction> action(Gtk::RadioAction::create(quality_group,strprintf("lowres-pixel-%02d",i),
-                                                                                                                                                  strprintf(_("Set Low-Res pixel size to 2^%d"),i)));
-                       if(i==1)                        // default quality
+                       i = *iter;
+                       Glib::RefPtr<Gtk::RadioAction> action(Gtk::RadioAction::create(low_res_pixel_size_group,strprintf("lowres-pixel-%d",i),
+                                                                                                                                                  strprintf(_("Set Low-Res pixel size to %d"),i)));
+                       if(i==2)                        // default pixel size
                        {
                                action->set_active();
-                               work_area->set_lowrespixel(i);
+                               work_area->set_low_res_pixel_size(i);
                        }
                        action_group->add( action,
                                sigc::bind(
-                                       sigc::mem_fun(*work_area, &studio::WorkArea::set_lowrespixel),
+                                       sigc::mem_fun(*work_area, &studio::WorkArea::set_low_res_pixel_size),
                                        i
                                )
                        );
index aa3cb16..57799b1 100644 (file)
@@ -320,7 +320,7 @@ private:
        Glib::RefPtr<Gtk::ToggleAction> duck_mask_angle;
 
        Gtk::RadioButtonGroup quality_group;
-       Gtk::RadioButtonGroup lowrespixel_group;
+       Gtk::RadioButtonGroup low_res_pixel_size_group;
 
        Glib::RefPtr<Gtk::ActionGroup> action_group;
 
index 81d922d..ee80f32 100644 (file)
@@ -152,7 +152,7 @@ Renderer_Canvas::render_vfunc(
                }
                else
                {
-                       int div = 1 << get_work_area()->get_lowrespixel();
+                       int div = get_work_area()->get_low_res_pixel_size();
                        const int width_in_tiles(w/tile_w+(((get_work_area()->get_low_resolution_flag())?((w/div)%(tile_w/div)):(w%tile_w))?1:0));
                        const int height_in_tiles(h/tile_h+(h%tile_h?1:0));
 
index 5cd526d..1b61346 100644 (file)
@@ -171,7 +171,7 @@ public:
                set_clipping(true);
                if(low_res)
                {
-                       int div = 1 << workarea->get_lowrespixel();
+                       int div = workarea->get_low_res_pixel_size();
                        set_tile_w(workarea->tile_w/div);
                        set_tile_h(workarea->tile_h/div);
                }
@@ -194,7 +194,7 @@ public:
                assert(workarea);
                newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
                if(low_res) {
-                       int div = 1 << workarea->get_lowrespixel();
+                       int div = workarea->get_low_res_pixel_size();
                        newdesc->set_wh(w/div,h/div);
                }
                else
@@ -309,7 +309,7 @@ public:
                        int h(get_tile_h());
                        int x(surface.get_w()*surface.get_h());
                        //if(low_res) {
-                       //      int div = 1 << workarea->get_lowrespixel();
+                       //      int div = workarea->get_low_res_pixel_size();
                        //      w/=div,h/=div;
                        //}
                        Color dark(0.6,0.6,0.6);
@@ -351,7 +351,7 @@ public:
                if(low_res)
                {
                        // We need to scale up
-                       int div = 1 << workarea->get_lowrespixel();
+                       int div = workarea->get_low_res_pixel_size();
                        pixbuf=pixbuf->scale_simple(
                                surface.get_w()*div,
                                surface.get_h()*div,
@@ -476,7 +476,7 @@ public:
                newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
                if(low_res)
                {
-                       int div = 1 << workarea->get_lowrespixel();
+                       int div = workarea->get_low_res_pixel_size();
                        newdesc->set_wh(w/div,h/div);
                }
                else
@@ -555,7 +555,7 @@ public:
                        //int h(surface.get_h());
                        int x(surface.get_w()*surface.get_h());
                        //if(low_res) {
-                       //      int div = 1 << workarea->get_lowrespixel();
+                       //      int div = workarea->get_low_res_pixel_size();
                        //      w/=div,h/=div;
                        //}
                        Color dark(0.6,0.6,0.6);
@@ -564,7 +564,7 @@ public:
                        int th=workarea->tile_h;
                        if(low_res)
                        {
-                               int div = 1 << workarea->get_lowrespixel();
+                               int div = workarea->get_low_res_pixel_size();
                                tw/=div;
                                th/=div;
                        }
@@ -597,7 +597,7 @@ public:
                if(low_res)
                {
                        // We need to scale up
-                       int div = 1 << workarea->get_lowrespixel();
+                       int div = workarea->get_low_res_pixel_size();
                        pixbuf=pixbuf->scale_simple(
                                surface.get_w()*div,
                                surface.get_h()*div,
@@ -664,7 +664,7 @@ WorkArea::WorkArea(etl::loose_handle<synfigapp::CanvasInterface> canvas_interfac
        render_idle_func_id=0;
        zoom=prev_zoom=1.0;
        quality=10;
-       lowrespixel=1;
+       low_res_pixel_size=2;
        rendering=false;
        canceled_=false;
        low_resolution=true;
@@ -1994,7 +1994,7 @@ WorkArea::next_unrendered_tile(int refreshes)const
                x(focus_point[0]/pw+drawing_area->get_width()/2-w/2),
                y(focus_point[1]/ph+drawing_area->get_height()/2-h/2);
 
-       int div = 1 << lowrespixel;
+       int div = low_res_pixel_size;
        const int width_in_tiles(w/tile_w+((low_resolution?((w/div)%(tile_w/div)):(w%tile_w))?1:0));
        const int height_in_tiles(h/tile_h+(h%tile_h?1:0));
 
@@ -2162,11 +2162,11 @@ WorkArea::set_quality(int x)
 }
 
 void
-WorkArea::set_lowrespixel(int x)
+WorkArea::set_low_res_pixel_size(int x)
 {
-       if(x==lowrespixel)
+       if(x==low_res_pixel_size)
                return;
-       lowrespixel=x;
+       low_res_pixel_size=x;
        queue_render_preview();
 }
 
@@ -2267,7 +2267,7 @@ studio::WorkArea::async_update_preview()
 
        // if we have lots of pixels to render and the tile renderer isn't disabled, use it
        int div;
-       div = low_resolution ? (1 << lowrespixel) : 1;
+       div = low_resolution ? low_res_pixel_size : 1;
        if (w*h > 240*div*135*div && !getenv("SYNFIG_DISABLE_TILE_RENDER"))
        {
                // do a tile render
index f9ade43..ca4f7cc 100644 (file)
@@ -227,7 +227,7 @@ private:
        bool canceled_;
 
        int quality;
-       int lowrespixel;
+       int low_res_pixel_size;
 
        bool dirty_trap_enabled;
 
@@ -407,10 +407,10 @@ public:
        void popup_menu();
 
        int get_quality()const { return quality; }
-       int get_lowrespixel()const { return lowrespixel; }
+       int get_low_res_pixel_size()const { return low_res_pixel_size; }
 
        void set_quality(int x);
-       void set_lowrespixel(int x);
+       void set_low_res_pixel_size(int x);
 
 
        int get_w()const { return w; }