mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
brightness-contrast-effect: Don't actually run if it will have no effect
Don't run the shader and redirect to an FBO if it won't actually do anything. This saves us on resources a ton. https://bugzilla.gnome.org/show_bug.cgi?id=683066
This commit is contained in:
parent
b2b22dbe6c
commit
38b82cb22c
@ -120,6 +120,17 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
|
||||
clutter_brightness_contrast_effect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
will_have_no_effect (ClutterBrightnessContrastEffect *self)
|
||||
{
|
||||
return (self->brightness_red == no_change &&
|
||||
self->brightness_green == no_change &&
|
||||
self->brightness_blue == no_change &&
|
||||
self->contrast_red == no_change &&
|
||||
self->contrast_green == no_change &&
|
||||
self->contrast_blue == no_change);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
@ -129,6 +140,9 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
|
||||
return FALSE;
|
||||
|
||||
if (will_have_no_effect (self))
|
||||
return FALSE;
|
||||
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
||||
{
|
||||
/* if we don't have support for GLSL shaders then we
|
||||
|
Loading…
Reference in New Issue
Block a user