[mutter/gbsneto/explicit-framebuffer-preparations: 22/26] clutter-*-effect: Remove cogl_rectangle()
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/explicit-framebuffer-preparations: 22/26] clutter-*-effect: Remove cogl_rectangle()
- Date: Wed, 14 Nov 2018 15:05:01 +0000 (UTC)
commit 1584353b5088192cd93d6005b3aa2446aaf42480
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Nov 8 20:26:02 2018 -0200
clutter-*-effect: Remove cogl_rectangle()
All those effects have the same basic pattern of setting a
color of a pipeline, then drawing a rect with cogl_rectangle().
Thus, replacing those was as easy as retrieving the draw
framebuffer and calling cogl_framebuffer_draw_rectangle() on it.
clutter/clutter/clutter-blur-effect.c | 9 +++++----
clutter/clutter/clutter-brightness-contrast-effect.c | 9 +++++----
clutter/clutter/clutter-colorize-effect.c | 9 +++++----
clutter/clutter/clutter-desaturate-effect.c | 12 ++++++------
clutter/clutter/clutter-offscreen-effect.c | 14 ++++++++------
5 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/clutter/clutter/clutter-blur-effect.c b/clutter/clutter/clutter-blur-effect.c
index 35499c766..564f796b3 100644
--- a/clutter/clutter/clutter-blur-effect.c
+++ b/clutter/clutter/clutter-blur-effect.c
@@ -160,6 +160,7 @@ static void
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
+ CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
@@ -169,11 +170,11 @@ clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
paint_opacity,
paint_opacity,
paint_opacity);
- cogl_push_source (self->pipeline);
- cogl_rectangle (0, 0, self->tex_width, self->tex_height);
-
- cogl_pop_source ();
+ cogl_framebuffer_draw_rectangle (framebuffer,
+ self->pipeline,
+ 0, 0,
+ self->tex_width, self->tex_height);
}
static gboolean
diff --git a/clutter/clutter/clutter-brightness-contrast-effect.c
b/clutter/clutter/clutter-brightness-contrast-effect.c
index a1023f875..741a818fc 100644
--- a/clutter/clutter/clutter-brightness-contrast-effect.c
+++ b/clutter/clutter/clutter-brightness-contrast-effect.c
@@ -178,6 +178,7 @@ static void
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
+ CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
ClutterActor *actor;
guint8 paint_opacity;
@@ -189,11 +190,11 @@ clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect)
paint_opacity,
paint_opacity,
paint_opacity);
- cogl_push_source (self->pipeline);
- cogl_rectangle (0, 0, self->tex_width, self->tex_height);
-
- cogl_pop_source ();
+ cogl_framebuffer_draw_rectangle (framebuffer,
+ self->pipeline,
+ 0, 0,
+ self->tex_width, self->tex_height);
}
static void
diff --git a/clutter/clutter/clutter-colorize-effect.c b/clutter/clutter/clutter-colorize-effect.c
index d45422589..1662f7d28 100644
--- a/clutter/clutter/clutter-colorize-effect.c
+++ b/clutter/clutter/clutter-colorize-effect.c
@@ -148,6 +148,7 @@ static void
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
+ CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
ClutterActor *actor;
guint8 paint_opacity;
@@ -159,11 +160,11 @@ clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect)
paint_opacity,
paint_opacity,
paint_opacity);
- cogl_push_source (self->pipeline);
- cogl_rectangle (0, 0, self->tex_width, self->tex_height);
-
- cogl_pop_source ();
+ cogl_framebuffer_draw_rectangle (framebuffer,
+ self->pipeline,
+ 0, 0,
+ self->tex_width, self->tex_height);
}
static void
diff --git a/clutter/clutter/clutter-desaturate-effect.c b/clutter/clutter/clutter-desaturate-effect.c
index 5c283335e..061358a5f 100644
--- a/clutter/clutter/clutter-desaturate-effect.c
+++ b/clutter/clutter/clutter-desaturate-effect.c
@@ -155,6 +155,7 @@ static void
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
+ CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
ClutterActor *actor;
CoglHandle texture;
guint8 paint_opacity;
@@ -170,13 +171,12 @@ clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect)
paint_opacity,
paint_opacity,
paint_opacity);
- cogl_push_source (self->pipeline);
- cogl_rectangle (0, 0,
- cogl_texture_get_width (texture),
- cogl_texture_get_height (texture));
-
- cogl_pop_source ();
+ cogl_framebuffer_draw_rectangle (framebuffer,
+ self->pipeline,
+ 0, 0,
+ cogl_texture_get_width (texture),
+ cogl_texture_get_height (texture));
}
static void
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
index b612b0494..8a90be260 100644
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ b/clutter/clutter/clutter-offscreen-effect.c
@@ -352,6 +352,7 @@ static void
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
+ CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
@@ -361,18 +362,19 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
paint_opacity,
paint_opacity,
paint_opacity);
- cogl_set_source (priv->target);
/* At this point we are in stage coordinates translated so if
* we draw our texture using a textured quad the size of the paint
* box then we will overlay where the actor would have drawn if it
* hadn't been redirected offscreen.
*/
- cogl_rectangle_with_texture_coords (0, 0,
- cogl_texture_get_width (priv->texture),
- cogl_texture_get_height (priv->texture),
- 0.0, 0.0,
- 1.0, 1.0);
+ cogl_framebuffer_draw_textured_rectangle (framebuffer,
+ priv->target,
+ 0, 0,
+ cogl_texture_get_width (priv->texture),
+ cogl_texture_get_height (priv->texture),
+ 0.0, 0.0,
+ 1.0, 1.0);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]