mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
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.
This commit is contained in:
parent
203725bfd3
commit
4c3d9fccc1
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user