projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add 'help' icon to the toolbox.
[synfig.git]
/
synfig-studio
/
trunk
/
src
/
gtkmm
/
workarea.cpp
diff --git
a/synfig-studio/trunk/src/gtkmm/workarea.cpp
b/synfig-studio/trunk/src/gtkmm/workarea.cpp
index
9b77c6c
..
e783687
100644
(file)
--- a/
synfig-studio/trunk/src/gtkmm/workarea.cpp
+++ b/
synfig-studio/trunk/src/gtkmm/workarea.cpp
@@
-6,8
+6,8
@@
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-** Copyright 2006 Yue Shi Lai
-** Copyright (c) 2007 Chris Moore
+** Copyright
(c)
2006 Yue Shi Lai
+** Copyright (c) 2007
, 2008
Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
@@
-171,8
+171,9
@@
public:
set_clipping(true);
if(low_res)
{
set_clipping(true);
if(low_res)
{
- set_tile_w(workarea->tile_w/2);
- set_tile_h(workarea->tile_h/2);
+ int div = workarea->get_low_res_pixel_size();
+ set_tile_w(workarea->tile_w/div);
+ set_tile_h(workarea->tile_h/div);
}
else
{
}
else
{
@@
-192,8
+193,10
@@
public:
{
assert(workarea);
newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
{
assert(workarea);
newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
- if(low_res)
- newdesc->set_wh(w/2,h/2);
+ if(low_res) {
+ int div = workarea->get_low_res_pixel_size();
+ newdesc->set_wh(w/div,h/div);
+ }
else
newdesc->set_wh(w,h);
else
newdesc->set_wh(w,h);
@@
-305,7
+308,10
@@
public:
int w(get_tile_w());
int h(get_tile_h());
int x(surface.get_w()*surface.get_h());
int w(get_tile_w());
int h(get_tile_h());
int x(surface.get_w()*surface.get_h());
- //if(low_res) { w/=2,h/=2; }
+ //if(low_res) {
+ // int div = workarea->get_low_res_pixel_size();
+ // w/=div,h/=div;
+ //}
Color dark(0.6,0.6,0.6);
Color lite(0.8,0.8,0.8);
for(int i=0;i<x;i++)
Color dark(0.6,0.6,0.6);
Color lite(0.8,0.8,0.8);
for(int i=0;i<x;i++)
@@
-345,9
+351,10
@@
public:
if(low_res)
{
// We need to scale up
if(low_res)
{
// We need to scale up
+ int div = workarea->get_low_res_pixel_size();
pixbuf=pixbuf->scale_simple(
pixbuf=pixbuf->scale_simple(
- surface.get_w()*
2
,
- surface.get_h()*
2
,
+ surface.get_w()*
div
,
+ surface.get_h()*
div
,
Gdk::INTERP_NEAREST
);
}
Gdk::INTERP_NEAREST
);
}
@@
-468,7
+475,10
@@
public:
assert(workarea);
newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
if(low_res)
assert(workarea);
newdesc->set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
if(low_res)
- newdesc->set_wh(w/2,h/2);
+ {
+ int div = workarea->get_low_res_pixel_size();
+ newdesc->set_wh(w/div,h/div);
+ }
else
newdesc->set_wh(w,h);
else
newdesc->set_wh(w,h);
@@
-544,15
+554,19
@@
public:
int w(surface.get_w());
//int h(surface.get_h());
int x(surface.get_w()*surface.get_h());
int w(surface.get_w());
//int h(surface.get_h());
int x(surface.get_w()*surface.get_h());
- //if(low_res) { w/=2,h/=2; }
+ //if(low_res) {
+ // int div = workarea->get_low_res_pixel_size();
+ // w/=div,h/=div;
+ //}
Color dark(0.6,0.6,0.6);
Color lite(0.8,0.8,0.8);
int tw=workarea->tile_w;
int th=workarea->tile_h;
if(low_res)
{
Color dark(0.6,0.6,0.6);
Color lite(0.8,0.8,0.8);
int tw=workarea->tile_w;
int th=workarea->tile_h;
if(low_res)
{
- tw/=2;
- th/=2;
+ int div = workarea->get_low_res_pixel_size();
+ tw/=div;
+ th/=div;
}
for(int i=0;i<x;i++)
dest=Color2PixelFormat(
}
for(int i=0;i<x;i++)
dest=Color2PixelFormat(
@@
-583,9
+597,10
@@
public:
if(low_res)
{
// We need to scale up
if(low_res)
{
// We need to scale up
+ int div = workarea->get_low_res_pixel_size();
pixbuf=pixbuf->scale_simple(
pixbuf=pixbuf->scale_simple(
- surface.get_w()*
2
,
- surface.get_h()*
2
,
+ surface.get_w()*
div
,
+ surface.get_h()*
div
,
Gdk::INTERP_NEAREST
);
}
Gdk::INTERP_NEAREST
);
}
@@
-649,6
+664,7
@@
WorkArea::WorkArea(etl::loose_handle<synfigapp::CanvasInterface> canvas_interfac
render_idle_func_id=0;
zoom=prev_zoom=1.0;
quality=10;
render_idle_func_id=0;
zoom=prev_zoom=1.0;
quality=10;
+ low_res_pixel_size=2;
rendering=false;
canceled_=false;
low_resolution=true;
rendering=false;
canceled_=false;
low_resolution=true;
@@
-1183,8
+1199,6
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
bool is_mouse(false);
Gdk::ModifierType modifier(Gdk::ModifierType(0));
bool is_mouse(false);
Gdk::ModifierType modifier(Gdk::ModifierType(0));
- drawing_area->grab_focus();
-
// Handle input stuff
if(
event->any.type==GDK_MOTION_NOTIFY ||
// Handle input stuff
if(
event->any.type==GDK_MOTION_NOTIFY ||
@@
-1204,6
+1218,7
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
{
device=event->button.device;
modifier=Gdk::ModifierType(event->button.state);
{
device=event->button.device;
modifier=Gdk::ModifierType(event->button.state);
+ drawing_area->grab_focus();
}
// Make sure we recognize the device
}
// Make sure we recognize the device
@@
-1332,8
+1347,11
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
selected_bezier=find_bezier(mouse_pos,radius,&bezier_click_pos);
selected_bezier=find_bezier(mouse_pos,radius,&bezier_click_pos);
- if(duck
&& duck->get_editable()
)
+ if(duck)
{
{
+ if (!duck->get_editable())
+ return true;
+
//get_selected_duck()->signal_user_click(0)();
//if(clicked_duck)clicked_duck->signal_user_click(0)();
//get_selected_duck()->signal_user_click(0)();
//if(clicked_duck)clicked_duck->signal_user_click(0)();
@@
-1906,6
+1924,9
@@
WorkArea::refresh_dimension_info()
pw=canvaswidth/w;
ph=canvasheight/h;
pw=canvaswidth/w;
ph=canvasheight/h;
+ Duckmatic::set_flip_x(pw < 0);
+ Duckmatic::set_flip_y(ph > 0);
+
scrollx_adjustment.set_page_increment(abs(get_grid_size()[0]));
scrollx_adjustment.set_step_increment(abs(pw));
scrollx_adjustment.set_lower(-abs(canvaswidth));
scrollx_adjustment.set_page_increment(abs(get_grid_size()[0]));
scrollx_adjustment.set_step_increment(abs(pw));
scrollx_adjustment.set_lower(-abs(canvaswidth));
@@
-1978,7
+1999,8
@@
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);
x(focus_point[0]/pw+drawing_area->get_width()/2-w/2),
y(focus_point[1]/ph+drawing_area->get_height()/2-h/2);
- const int width_in_tiles(w/tile_w+((low_resolution?((w/2)%(tile_w/2)):(w%tile_w))?1:0));
+ 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));
int
const int height_in_tiles(h/tile_h+(h%tile_h?1:0));
int
@@
-2144,6
+2166,14
@@
WorkArea::set_quality(int x)
queue_render_preview();
}
queue_render_preview();
}
+void
+WorkArea::set_low_res_pixel_size(int x)
+{
+ if(x==low_res_pixel_size)
+ return;
+ low_res_pixel_size=x;
+ queue_render_preview();
+}
namespace studio
{
namespace studio
{
@@
-2231,6
+2261,11
@@
studio::WorkArea::async_update_preview()
int w=(int)(desc.get_w()*zoom);
int h=(int)(desc.get_h()*zoom);
int w=(int)(desc.get_w()*zoom);
int h=(int)(desc.get_h()*zoom);
+ // ensure that the size we draw is at least one pixel in each dimension
+ int min_size = low_resolution ? low_res_pixel_size : 1;
+ if (w < min_size) w = min_size;
+ if (h < min_size) h = min_size;
+
// Setup the description parameters
desc.set_antialias(1);
desc.set_time(cur_time);
// Setup the description parameters
desc.set_antialias(1);
desc.set_time(cur_time);
@@
-2241,8
+2276,9
@@
studio::WorkArea::async_update_preview()
handle<Target> target;
// if we have lots of pixels to render and the tile renderer isn't disabled, use it
handle<Target> target;
// if we have lots of pixels to render and the tile renderer isn't disabled, use it
- if(w*h>(low_resolution?480*270:480*270/2) &&
- !getenv("SYNFIG_DISABLE_TILE_RENDER"))
+ int div;
+ div = low_resolution ? low_res_pixel_size : 1;
+ if (w*h > 240*div*135*div && !getenv("SYNFIG_DISABLE_TILE_RENDER"))
{
// do a tile render
handle<WorkAreaTarget> trgt(new class WorkAreaTarget(this,w,h));
{
// do a tile render
handle<WorkAreaTarget> trgt(new class WorkAreaTarget(this,w,h));