[clutter] brightness-contrast-effect: Don't actually run if it will have no effect
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] brightness-contrast-effect: Don't actually run if it will have no effect
- Date: Mon, 3 Sep 2012 08:03:00 +0000 (UTC)
commit 38b82cb22c7968e0a33be56ec3b0d376e2baa08d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Aug 30 16:48:44 2012 -0300
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
clutter/clutter-brightness-contrast-effect.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-brightness-contrast-effect.c b/clutter/clutter-brightness-contrast-effect.c
index 97d9b86..7b03732 100644
--- a/clutter/clutter-brightness-contrast-effect.c
+++ b/clutter/clutter-brightness-contrast-effect.c
@@ -121,6 +121,17 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
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)
{
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]