From c6e0c8430f1e84e53c64a0bc2c1963ec3157e2c3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 7 Sep 2015 13:35:11 +0200 Subject: [PATCH 1/1] image-surface/software rendering as preference --- gtk2_ardour/rc_option_editor.cc | 23 ++++++++++++++++++++--- gtk2_ardour/ui_config.cc | 9 +++++++++ gtk2_ardour/ui_config_vars.h | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 1543dfae0e..fce5a4a780 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -21,6 +21,10 @@ #include "gtk2ardour-config.h" #endif +#if !defined USE_CAIRO_IMAGE_SURFACE && !defined NDEBUG +#define OPTIONAL_CAIRO_IMAGE_SURFACE +#endif + #include #include @@ -2776,18 +2780,31 @@ RCOptionEditor::RCOptionEditor () /* INTERFACE */ +#ifdef OPTIONAL_CAIRO_IMAGE_SURFACE + BoolOption* bgo = new BoolOption ( + "cairo-image-surface", + _("Disable Graphics Hardware Acceleration (requires restart)"), + sigc::mem_fun (*_ui_config, &UIConfiguration::get_cairo_image_surface), + sigc::mem_fun (*_ui_config, &UIConfiguration::set_cairo_image_surface) + ); + + Gtkmm2ext::UI::instance()->set_tip (bgo->tip_widget(), string_compose ( + _("Render large parts of the application user-interface in software, instead of using 2D-graphics acceleration.\nThis requires restarting %1 before having an effect"), PROGRAM_NAME)); + add_option (S_("Preferences|GUI"), bgo); +#endif + #ifdef CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE BoolOption* bgo = new BoolOption ( "buggy-gradients", - _("Possibly improve slow graphical performance"), + _("Possibly improve slow graphical performance (requires restart)"), sigc::mem_fun (*_ui_config, &UIConfiguration::get_buggy_gradients), sigc::mem_fun (*_ui_config, &UIConfiguration::set_buggy_gradients) ); - Gtkmm2ext::UI::instance()->set_tip (bgo->tip_widget(), string_compose (_("This requires restarting %1 before having an effect"), PROGRAM_NAME)); + Gtkmm2ext::UI::instance()->set_tip (bgo->tip_widget(), string_compose (_("Disables hardware gradient rendering on buggy video drivers (\"buggy gradients patch\").\nThis requires restarting %1 before having an effect"), PROGRAM_NAME)); add_option (S_("Preferences|GUI"), bgo); #endif - + add_option (S_("Preferences|GUI"), new BoolOption ( "widget-prelight", diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 1fe2d4135f..e20eb6fc72 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -17,6 +17,10 @@ */ +#if !defined USE_CAIRO_IMAGE_SURFACE && !defined NDEBUG +#define OPTIONAL_CAIRO_IMAGE_SURFACE +#endif + #include #include #include @@ -156,6 +160,11 @@ UIConfiguration::pre_gui_init () if (get_buggy_gradients()) { g_setenv ("FORCE_BUGGY_GRADIENTS", "1", 1); } +#endif +#ifdef OPTIONAL_CAIRO_IMAGE_SURFACE + if (get_cairo_image_surface()) { + g_setenv ("ARDOUR_IMAGE_SURFACE", "1", 1); + } #endif return 0; } diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index ae6648ab96..04865674e7 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -72,4 +72,5 @@ UI_CONFIG_VARIABLE (double, waveform_clip_level, "waveform-clip-level", -0.09339 UI_CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true) UI_CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) UI_CONFIG_VARIABLE (bool, buggy_gradients, "buggy-gradients", false) +UI_CONFIG_VARIABLE (bool, cairo_image_surface, "cairo-image-surface", false) UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */ -- 2.30.2