clutter/offscreen-effect: Remove implicit API

This commit is contained in:
Georges Basile Stavracas Neto 2019-03-11 20:05:09 -03:00
parent 5289026257
commit c356a2da83
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -325,7 +325,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
* contents on screen... * contents on screen...
*/ */
clutter_actor_get_transform (priv->stage, &modelview); clutter_actor_get_transform (priv->stage, &modelview);
cogl_set_modelview_matrix (&modelview); cogl_framebuffer_set_modelview_matrix (priv->offscreen, &modelview);
/* Save the original viewport for calculating priv->position */ /* Save the original viewport for calculating priv->position */
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage), _clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
@ -337,10 +337,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
/* Set up the viewport so that it has the same size as the stage (avoid /* Set up the viewport so that it has the same size as the stage (avoid
* distortion), but translated to account for the FBO offset... * distortion), but translated to account for the FBO offset...
*/ */
cogl_set_viewport (-priv->fbo_offset_x, cogl_framebuffer_set_viewport (priv->offscreen,
-priv->fbo_offset_y, -priv->fbo_offset_x,
stage_width, -priv->fbo_offset_y,
stage_height); stage_width,
stage_height);
/* Copy the stage's projection matrix across to the framebuffer */ /* Copy the stage's projection matrix across to the framebuffer */
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage), _clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
@ -357,14 +358,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
&priv->position, &priv->position,
1); 1);
cogl_set_projection_matrix (&projection); cogl_framebuffer_set_projection_matrix (priv->offscreen, &projection);
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0); cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
cogl_clear (&transparent, cogl_framebuffer_clear (priv->offscreen,
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH); COGL_BUFFER_BIT_DEPTH,
&transparent);
cogl_push_matrix (); cogl_framebuffer_push_matrix (priv->offscreen);
/* Override the actor's opacity to fully opaque - we paint the offscreen /* Override the actor's opacity to fully opaque - we paint the offscreen
* texture with the actor's paint opacity, so we need to do this to avoid * texture with the actor's paint opacity, so we need to do this to avoid
@ -410,15 +412,16 @@ static void
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect) clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
{ {
ClutterOffscreenEffectPrivate *priv = effect->priv; ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglMatrix modelview; CoglMatrix modelview;
float resource_scale; float resource_scale;
cogl_push_matrix (); cogl_framebuffer_push_matrix (framebuffer);
/* The current modelview matrix is *almost* perfect already. It's only /* The current modelview matrix is *almost* perfect already. It's only
* missing a correction for the expanded FBO and offset rendering within... * missing a correction for the expanded FBO and offset rendering within...
*/ */
cogl_get_modelview_matrix (&modelview); cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) && if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
resource_scale != 1.0f) resource_scale != 1.0f)
@ -431,14 +434,15 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
priv->fbo_offset_x, priv->fbo_offset_x,
priv->fbo_offset_y, priv->fbo_offset_y,
0.0f); 0.0f);
cogl_set_modelview_matrix (&modelview);
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
/* paint the target material; this is virtualized for /* paint the target material; this is virtualized for
* sub-classes that require special hand-holding * sub-classes that require special hand-holding
*/ */
clutter_offscreen_effect_paint_target (effect); clutter_offscreen_effect_paint_target (effect);
cogl_pop_matrix (); cogl_framebuffer_pop_matrix (framebuffer);
} }
static void static void
@ -455,7 +459,7 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect)
/* Restore the previous opacity override */ /* Restore the previous opacity override */
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override); clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
cogl_pop_matrix (); cogl_framebuffer_pop_matrix (priv->offscreen);
cogl_pop_framebuffer (); cogl_pop_framebuffer ();
clutter_offscreen_effect_paint_texture (self); clutter_offscreen_effect_paint_texture (self);