projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use Color::is_straight(). Also, re-enable the optimization for straight blending...
[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
54216f3
..
6e31a6e
100644
(file)
--- a/
synfig-studio/trunk/src/gtkmm/workarea.cpp
+++ b/
synfig-studio/trunk/src/gtkmm/workarea.cpp
@@
-72,6
+72,8
@@
#include <synfig/mutex.h>
#include <synfig/mutex.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
#endif
/* === U S I N G =========================================================== */
@@
-628,14
+630,14
@@
WorkArea::WorkArea(etl::loose_handle<synfigapp::CanvasInterface> canvas_interfac
canvas(canvas_interface->get_canvas()),
scrollx_adjustment(0,-4,4,0.01,0.1),
scrolly_adjustment(0,-4,4,0.01,0.1),
canvas(canvas_interface->get_canvas()),
scrollx_adjustment(0,-4,4,0.01,0.1),
scrolly_adjustment(0,-4,4,0.01,0.1),
- w(
128
),
- h(
128
),
+ w(
TILE_SIZE
),
+ h(
TILE_SIZE
),
last_event_time(0),
progresscallback(0),
dragging(DRAG_NONE),
show_grid(false),
last_event_time(0),
progresscallback(0),
dragging(DRAG_NONE),
show_grid(false),
- tile_w(
128
),
- tile_h(
128
),
+ tile_w(
TILE_SIZE
),
+ tile_h(
TILE_SIZE
),
timecode_width(0),
timecode_height(0)
{
timecode_width(0),
timecode_height(0)
{
@@
-810,6
+812,19
@@
WorkArea::~WorkArea()
render_idle_func_id=0;
}
render_idle_func_id=0;
}
+bool
+WorkArea::get_updating()const
+{
+ return App::single_threaded && async_renderer && async_renderer->updating;
+}
+
+void
+WorkArea::stop_updating(bool cancel)
+{
+ async_renderer->stop();
+ if (cancel) canceled_=true;
+}
+
void
WorkArea::save_meta_data()
{
void
WorkArea::save_meta_data()
{
@@
-1048,7
+1063,7
@@
void
WorkArea::set_focus_point(const synfig::Point &point)
{
// These next three lines try to ensure that we place the
WorkArea::set_focus_point(const synfig::Point &point)
{
// These next three lines try to ensure that we place the
- // focus on a pixel boundry
+ // focus on a pixel bound
a
ry
/*Point adjusted(point[0]/abs(get_pw()),point[1]/abs(get_ph()));
adjusted[0]=(abs(adjusted[0]-floor(adjusted[0]))<0.5)?floor(adjusted[0])*abs(get_pw()):ceil(adjusted[0])*abs(get_ph());
adjusted[1]=(abs(adjusted[1]-floor(adjusted[1]))<0.5)?floor(adjusted[1])*abs(get_ph()):ceil(adjusted[1])*abs(get_ph());
/*Point adjusted(point[0]/abs(get_pw()),point[1]/abs(get_ph()));
adjusted[0]=(abs(adjusted[0]-floor(adjusted[0]))<0.5)?floor(adjusted[0])*abs(get_pw()):ceil(adjusted[0])*abs(get_ph());
adjusted[1]=(abs(adjusted[1]-floor(adjusted[1]))<0.5)?floor(adjusted[1])*abs(get_ph()):ceil(adjusted[1])*abs(get_ph());
@@
-1189,7
+1204,7
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
modifier=Gdk::ModifierType(event->button.state);
}
modifier=Gdk::ModifierType(event->button.state);
}
- // Make sure we recogni
s
e the device
+ // Make sure we recogni
z
e the device
if(curr_input_device)
{
if(curr_input_device!=device)
if(curr_input_device)
{
if(curr_input_device!=device)
@@
-1255,7
+1270,7
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
// GDK mouse scrolling events
else if(event->any.type==GDK_SCROLL)
{
// GDK mouse scrolling events
else if(event->any.type==GDK_SCROLL)
{
- // GDK information needed to properly interpret
e
mouse
+ // GDK information needed to properly interpret mouse
// scrolling events are: scroll.state, scroll.x/scroll.y, and
// scroll.direction. The value of scroll.direction will be
// obtained later.
// scrolling events are: scroll.state, scroll.x/scroll.y, and
// scroll.direction. The value of scroll.direction will be
// obtained later.
@@
-1432,19
+1447,15
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
if(get_selected_ducks().size()<=1)
duck->signal_user_click(2)();
else
if(get_selected_ducks().size()<=1)
duck->signal_user_click(2)();
else
- {
canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MULTIPLE_DUCKS_CLICKED,BUTTON_RIGHT,mouse_pos,pressure,modifier));
canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MULTIPLE_DUCKS_CLICKED,BUTTON_RIGHT,mouse_pos,pressure,modifier));
- }
return true;
}
return true;
}
- else
- if(bezier)
+ else if(bezier)
{
bezier->signal_user_click(2)(bezier_click_pos);
return true;
}
{
bezier->signal_user_click(2)(bezier_click_pos);
return true;
}
- else
- if(layer)
+ else if (layer)
{
if(canvas_view->get_smach().process_event(EventLayerClick(layer,BUTTON_RIGHT,mouse_pos))==Smach::RESULT_OK)
return false;
{
if(canvas_view->get_smach().process_event(EventLayerClick(layer,BUTTON_RIGHT,mouse_pos))==Smach::RESULT_OK)
return false;
@@
-1482,7
+1493,7
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
signal_cursor_moved_();
signal_cursor_moved_();
- // Guide/Duck hilights on hover
+ // Guide/Duck hi
gh
lights on hover
if(dragging==DRAG_NONE)
{
GuideList::iterator iter;
if(dragging==DRAG_NONE)
{
GuideList::iterator iter;
@@
-1533,11
+1544,13
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
drawing_area->queue_draw();
}
drawing_area->queue_draw();
}
+
if(dragging==DRAG_BOX)
{
curr_point=mouse_pos;
drawing_area->queue_draw();
}
if(dragging==DRAG_BOX)
{
curr_point=mouse_pos;
drawing_area->queue_draw();
}
+
if(dragging==DRAG_GUIDE)
{
if(curr_guide_is_x)
if(dragging==DRAG_GUIDE)
{
if(curr_guide_is_x)
@@
-1546,30
+1559,34
@@
WorkArea::on_drawing_area_event(GdkEvent *event)
*curr_guide=mouse_pos[1];
drawing_area->queue_draw();
}
*curr_guide=mouse_pos[1];
drawing_area->queue_draw();
}
+
if(dragging!=DRAG_WINDOW)
{ // Update those triangle things on the rulers
const synfig::Point point(mouse_pos);
hruler->property_position()=Distance(point[0],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
vruler->property_position()=Distance(point[1],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
}
if(dragging!=DRAG_WINDOW)
{ // Update those triangle things on the rulers
const synfig::Point point(mouse_pos);
hruler->property_position()=Distance(point[0],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
vruler->property_position()=Distance(point[1],Distance::SYSTEM_UNITS).get(App::distance_system,get_canvas()->rend_desc());
}
- if(dragging==DRAG_WINDOW)
- {
- set_focus_point(get_focus_point()
+
mouse_pos-drag_point);
- }
- else
-
if(event->motion.state&GDK_BUTTON1_MASK && canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG,BUTTON_LEFT,mouse_pos,pressure,modifier))==
Smach::RESULT_ACCEPT)
+
+ if(dragging == DRAG_WINDOW)
+ set_focus_point(get_focus_point()
+
mouse_pos-drag_point);
+ else if (event->motion.state & GDK_BUTTON1_MASK &&
+ canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG, BUTTON_LEFT,
+
mouse_pos,pressure,modifier)) ==
Smach::RESULT_ACCEPT)
return true;
return true;
- else
- if(event->motion.state&GDK_BUTTON2_MASK && canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG,BUTTON_MIDDLE,mouse_pos,pressure,modifier))==Smach::RESULT_ACCEPT)
+ else if (event->motion.state & GDK_BUTTON2_MASK &&
+ canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG, BUTTON_MIDDLE,
+ mouse_pos, pressure, modifier)) == Smach::RESULT_ACCEPT)
return true;
return true;
- else
- if(event->motion.state&GDK_BUTTON3_MASK && canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG,BUTTON_RIGHT,mouse_pos,pressure,modifier))==Smach::RESULT_ACCEPT)
+ else if (event->motion.state & GDK_BUTTON3_MASK &&
+ canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DRAG, BUTTON_RIGHT,
+ mouse_pos, pressure, modifier)) == Smach::RESULT_ACCEPT)
return true;
return true;
- else
-
if(canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_MOTION,BUTTON_NONE,mouse_pos,pressure,modifier))==
Smach::RESULT_ACCEPT)
+ else
if(canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_MOTION, BUTTON_NONE,
+
mouse_pos, pressure,modifier)) ==
Smach::RESULT_ACCEPT)
return true;
break;
return true;
break;
+
case GDK_BUTTON_RELEASE:
{
bool ret(false);
case GDK_BUTTON_RELEASE:
{
bool ret(false);
@@
-1852,10
+1869,8
@@
WorkArea::on_vruler_event(GdkEvent */*event*/)
switch(event->type)
{
case GDK_BUTTON_PRESS:
switch(event->type)
{
case GDK_BUTTON_PRESS:
- DEBUGPOINT();
if(dragging==DRAG_NONE)
{
if(dragging==DRAG_NONE)
{
- DEBUGPOINT();
dragging=DRAG_GUIDE;
curr_guide=get_guide_list_x().insert(get_guide_list_x().begin());
curr_guide_is_x=true;
dragging=DRAG_GUIDE;
curr_guide=get_guide_list_x().insert(get_guide_list_x().begin());
curr_guide_is_x=true;
@@
-1863,10
+1878,8
@@
WorkArea::on_vruler_event(GdkEvent */*event*/)
return true;
break;
case GDK_BUTTON_RELEASE:
return true;
break;
case GDK_BUTTON_RELEASE:
- DEBUGPOINT();
if(dragging==DRAG_GUIDE && curr_guide_is_x==true)
{
if(dragging==DRAG_GUIDE && curr_guide_is_x==true)
{
- DEBUGPOINT();
dragging=DRAG_NONE;
get_guide_list_x().erase(curr_guide);
}
dragging=DRAG_NONE;
get_guide_list_x().erase(curr_guide);
}
@@
-1963,7
+1976,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);
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+(
w%tile_w
?1:0));
+ const int width_in_tiles(w/tile_w+(
(low_resolution?((w/2)%(tile_w/2)):(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
@@
-2174,9
+2187,10
@@
public:
bool
studio::WorkArea::async_update_preview()
{
bool
studio::WorkArea::async_update_preview()
{
- if (
single_threaded() && async_renderer && async_renderer->updating == true
)
+ if (
get_updating()
)
{
{
- async_renderer->stop();
+ stop_updating();
+ queue_render_preview();
return false;
}
return false;
}
@@
-2224,8
+2238,11
@@
studio::WorkArea::async_update_preview()
// Create the render target
handle<Target> target;
// Create the render target
handle<Target> target;
- if(w*h>(low_resolution?480*270:480*270/2))
+ // 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"))
{
{
+ // do a tile render
handle<WorkAreaTarget> trgt(new class WorkAreaTarget(this,w,h));
trgt->set_rend_desc(&desc);
handle<WorkAreaTarget> trgt(new class WorkAreaTarget(this,w,h));
trgt->set_rend_desc(&desc);
@@
-2234,6
+2251,7
@@
studio::WorkArea::async_update_preview()
}
else
{
}
else
{
+ // do a scanline render
handle<WorkAreaTarget_Full> trgt(new class WorkAreaTarget_Full(this,w,h));
trgt->set_rend_desc(&desc);
handle<WorkAreaTarget_Full> trgt(new class WorkAreaTarget_Full(this,w,h));
trgt->set_rend_desc(&desc);
@@
-2258,7
+2276,7
@@
studio::WorkArea::async_update_preview()
synfig::ProgressCallback *cb=get_canvas_view()->get_ui_interface().get();
rendering=true;
synfig::ProgressCallback *cb=get_canvas_view()->get_ui_interface().get();
rendering=true;
- cb->task(
"Rendering..."
);
+ cb->task(
_("Rendering...")
);
rendering=true;
return true;
rendering=true;
return true;
@@
-2280,12
+2298,12
@@
studio::WorkArea::async_update_finished()
{
dirty=false;
//queued=false;
{
dirty=false;
//queued=false;
- cb->task(
"Idle"
);
+ cb->task(
_("Idle")
);
}
else
{
dirty=true;
}
else
{
dirty=true;
- cb->task(
"Render Failed"
);
+ cb->task(
_("Render Failed")
);
}
//get_canvas_view()->reset_cancel_status();
done_rendering();
}
//get_canvas_view()->reset_cancel_status();
done_rendering();
@@
-2359,7
+2377,7
@@
again:
target->set_avoid_time_sync(true);
if(cb)
target->set_avoid_time_sync(true);
if(cb)
- cb->task(strprintf(
"Rendering canvas %s..."
,get_canvas()->get_name().c_str()));
+ cb->task(strprintf(
_("Rendering canvas %s...")
,get_canvas()->get_name().c_str()));
bool ret = target->render(cb);
bool ret = target->render(cb);
@@
-2375,9
+2393,9
@@
again:
if(cb)
{
if(ret)
if(cb)
{
if(ret)
- cb->task(
"Idle"
);
+ cb->task(
_("Idle")
);
else
else
- cb->task(
"Render Failed"
);
+ cb->task(
_("Render Failed")
);
cb->amount_complete(0,1);
}
cb->amount_complete(0,1);
}
@@
-2400,7
+2418,7
@@
again:
}
void
}
void
-studio::WorkArea::async_render_preview(Time time)
+studio::WorkArea::async_render_preview(
synfig::
Time time)
{
cur_time=time;
//tile_book.clear();
{
cur_time=time;
//tile_book.clear();
@@
-2421,7
+2439,7
@@
WorkArea::async_render_preview()
}
bool
}
bool
-studio::WorkArea::sync_render_preview(Time time)
+studio::WorkArea::sync_render_preview(
synfig::
Time time)
{
cur_time=time;
//tile_book.clear();
{
cur_time=time;
//tile_book.clear();
@@
-2631,12
+2649,12
@@
studio::WorkArea::set_cursor(Gdk::CursorType x)
drawing_area->get_window()->set_cursor(Gdk::Cursor(x));
}
drawing_area->get_window()->set_cursor(Gdk::Cursor(x));
}
-#include "iconcontroler.h"
+#include "iconcontrol
l
er.h"
void
studio::WorkArea::refresh_cursor()
{
void
studio::WorkArea::refresh_cursor()
{
-// set_cursor(IconControler::get_tool_cursor(canvas_view->get_smach().get_state_name(),drawing_area->get_window()));
+// set_cursor(IconControl
l
er::get_tool_cursor(canvas_view->get_smach().get_state_name(),drawing_area->get_window()));
}
void
}
void