std::list< etl::handle< studio::Module > > module_list_;
bool studio::App::use_colorspace_gamma=true;
+#ifdef SINGLE_THREADED
bool studio::App::single_threaded=false;
+#endif
bool studio::App::restrict_radius_ducks=false;
String studio::App::browser_command("firefox");
value=strprintf("%s",Distance::system_name(App::distance_system).c_str());
return true;
}
+#ifdef SINGLE_THREADED
if(key=="single_threaded")
{
value=strprintf("%i",(int)App::single_threaded);
return true;
}
+#endif
if(key=="auto_recover_backup_interval")
{
value=strprintf("%i",App::auto_recover->get_timeout());
App::distance_system=Distance::ident_system(value);;
return true;
}
+#ifdef SINGLE_THREADED
if(key=="single_threaded")
{
int i(atoi(value.c_str()));
App::single_threaded=i;
return true;
}
+#endif
if(key=="restrict_radius_ducks")
{
int i(atoi(value.c_str()));
ret.push_back("distance_system");
ret.push_back("file_history.size");
ret.push_back("use_colorspace_gamma");
+#ifdef SINGLE_THREADED
ret.push_back("single_threaded");
+#endif
ret.push_back("auto_recover_backup_interval");
ret.push_back("restrict_radius_ducks");
ret.push_back("browser_command");
synfigapp::Main::settings().set_value("dock.dialog.2.size","1045 235");
synfigapp::Main::settings().set_value("pref.distance_system","pt");
synfigapp::Main::settings().set_value("pref.use_colorspace_gamma","1");
+#ifdef SINGLE_THREADED
synfigapp::Main::settings().set_value("pref.single_threaded","0");
+#endif
synfigapp::Main::settings().set_value("pref.restrict_radius_ducks","0");
synfigapp::Main::settings().set_value("window.toolbox.pos","4 4");
}
static bool use_colorspace_gamma;
+#ifdef SINGLE_THREADED
static bool single_threaded;
+#endif
static bool restrict_radius_ducks;
virtual void end_frame()
{
+#ifdef SINGLE_THREADED
if (!single_threaded())
{
+#endif
while(alive_flag)
{
Glib::Mutex::Lock lock(mutex);
else
break;
}
+#ifdef SINGLE_THREADED
}
+#endif
Glib::Mutex::Lock lock(mutex);
if(!alive_flag)
return;
#endif
}
+#ifdef SINGLE_THREADED
if (single_threaded())
signal_progress()();
else
+#endif
while(alive_flag && !ready_next)
{
Glib::Mutex::Lock lock(mutex);
Glib::Mutex::Lock lock(mutex);
if(alive_flag)
alive_flag=warm_target->add_frame(&surface);
- if (!single_threaded()) cond_frame_queue_empty.signal();
+#ifdef SINGLE_THREADED
+ if (!single_threaded())
+#endif
+ cond_frame_queue_empty.signal();
ready_next=true;
}
};
AsyncRenderer::AsyncRenderer(etl::handle<synfig::Target> target_,synfig::ProgressCallback *cb):
error(false),
success(false),
- cb(cb),
- updating(false)
+ cb(cb)
+#ifdef SINGLE_THREADED
+ , updating(false)
+#endif
{
render_thread=0;
if(etl::handle<synfig::Target_Tile>::cast_dynamic(target_))
signal_stop_();
#if REJOIN_ON_STOP
- if (!single_threaded()) render_thread->join();
+#ifdef SINGLE_THREADED
+ if (!single_threaded())
+#endif
+ render_thread->join();
#endif
// Make sure all the dispatch crap is cleared out
);
}
+#ifdef SINGLE_THREADED
void
AsyncRenderer::rendering_progress()
{
while(studio::App::events_pending()) studio::App::iteration(false);
updating = false;
}
+#endif
void
AsyncRenderer::start_()
done_connection=signal_done_.connect(mem_fun(*this,&AsyncRenderer::stop));
#endif
+#ifdef SINGLE_THREADED
if (single_threaded())
{
synfig::info("%s:%d rendering in the same thread", __FILE__, __LINE__);
render_target();
}
else
+#endif
{
render_thread=Glib::Thread::create(
sigc::mem_fun(*this,&AsyncRenderer::render_target),
/* === M A C R O S ========================================================= */
-#define single_threaded() App::single_threaded
-#define NotLock Glib::NOT_LOCK
+// uncomment to use a single thread, and hopefully get more stability
+// #define SINGLE_THREADED
+#ifdef SINGLE_THREADED
+# define single_threaded() App::single_threaded
+#endif
/* === T Y P E D E F S ===================================================== */
void stop();
void pause();
void resume();
+#ifdef SINGLE_THREADED
void rendering_progress();
+ bool updating;
+#endif
bool has_error()const { return error; }
bool has_success()const { return success; }
- bool updating;
-
sigc::signal<void>& signal_finished() { return signal_finished_; }
sigc::signal<void>& signal_success() { return signal_success_; }
bool
CanvasView::close_instance()
{
+#ifdef SINGLE_THREADED
if (get_work_area()->get_updating())
{
get_work_area()->stop_updating(true); // stop and mark as cancelled
250);
}
else
+#endif
Glib::signal_timeout().connect(
sigc::bind(sigc::ptr_fun(_close_instance),
(etl::handle<Instance>)get_instance()),
adj_recent_files(15,1,50,1,1,1),
adj_undo_depth(100,10,5000,1,1,1),
toggle_use_colorspace_gamma(_("Visually Linear Color Selection")),
+#ifdef SINGLE_THREADED
toggle_single_threaded(_("Use Only a Single Thread")),
+#endif
toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant"))
{
// Setup the buttons
// Misc - use_colorspace_gamma
misc_table->attach(toggle_use_colorspace_gamma, 0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
+#ifdef SINGLE_THREADED
// Misc - single_threaded
- misc_table->attach(toggle_single_threaded, 0, 2, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
+ misc_table->attach(toggle_single_threaded, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
+#endif
// Misc - auto backup interval
attach_label(misc_table, _("Auto Backup Interval (0 to disable)"), 3, xpadding, ypadding);
misc_table->attach(auto_backup_interval, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
// Misc - restrict_radius_ducks
- misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
+ misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
// Misc - browser_command
attach_label(misc_table, _("Browser Command"), 4, xpadding, ypadding);
// Set the use_colorspace_gamma flag
App::use_colorspace_gamma=toggle_use_colorspace_gamma.get_active();
+#ifdef SINGLE_THREADED
// Set the single_threaded flag
App::single_threaded=toggle_single_threaded.get_active();
+#endif
// Set the auto backup interval
App::auto_recover->set_timeout(auto_backup_interval.get_value() * 1000);
// Refresh the status of the use_colorspace_gamma flag
toggle_use_colorspace_gamma.set_active(App::use_colorspace_gamma);
+#ifdef SINGLE_THREADED
// Refresh the status of the single_threaded flag
toggle_single_threaded.set_active(App::single_threaded);
+#endif
// Refresh the value of the auto backup interval
auto_backup_interval.set_value(App::auto_recover->get_timeout() / 1000);
Gtk::Adjustment adj_undo_depth;
Gtk::CheckButton toggle_use_colorspace_gamma;
+#ifdef SINGLE_THREADED
Gtk::CheckButton toggle_single_threaded;
+#endif
synfig::Time::Format time_format;
bool studio::Widget_NavView::on_expose_draw(GdkEventExpose */*exp*/)
{
+#ifdef SINGLE_THREADED
// don't redraw if the previous redraw is still running single-threaded
// or we end up destroying the renderer that's rendering it
if (App::single_threaded && renderer && renderer->updating)
return false;
+#endif
//print out the zoom
//HACK kind of...
if (!preview->renderer)
return;
+#ifdef SINGLE_THREADED
if (preview->renderer->updating)
preview->renderer->stop();
else
+#endif
preview->renderer.detach();
}
}
render_idle_func_id=0;
}
+#ifdef SINGLE_THREADED
bool
WorkArea::get_updating()const
{
return App::single_threaded && async_renderer && async_renderer->updating;
}
+#endif
+#ifdef SINGLE_THREADED
void
WorkArea::stop_updating(bool cancel)
{
async_renderer->stop();
if (cancel) canceled_=true;
}
+#endif
void
WorkArea::save_meta_data()
bool
studio::WorkArea::async_update_preview()
{
+#ifdef SINGLE_THREADED
if (get_updating())
{
stop_updating();
queue_render_preview();
return false;
}
+#endif
async_renderer=0;
bool get_canceled()const { return canceled_; }
bool get_queued()const { return queued; }
bool get_rendering()const { return rendering; }
+#ifdef SINGLE_THREADED
bool get_updating()const;
void stop_updating(bool cancel = false);
+#endif
bool get_full_frame()const { return full_frame; }
//int get_w()const { return w; }
//int get_h()const { return h; }