clutter, core: Stop using the Cogl framebuffer stack

The Cogl framebuffer stack is going away; replace all its uses by the
framebuffer stack carried by the paint context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
This commit is contained in:
Jonas Ådahl 2019-11-22 11:41:04 +01:00 committed by Georges Basile Stavracas Neto
parent 549f60fe49
commit 3f65837e0d
29 changed files with 105 additions and 79 deletions

View File

@ -162,7 +162,8 @@ clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (self->actor);

View File

@ -180,7 +180,8 @@ clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
guint8 paint_opacity;

View File

@ -150,7 +150,8 @@ clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
guint8 paint_opacity;

View File

@ -174,7 +174,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
CoglHandle material;
CoglPipeline *pipeline;
CoglDepthState depth_state;
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
if (priv->is_dirty)
{

View File

@ -157,7 +157,8 @@ clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor;
CoglHandle texture;
guint8 paint_opacity;

View File

@ -74,6 +74,7 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-volume-private.h"
#include "clutter-actor-box-private.h"
@ -317,8 +318,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_get_modelview_matrix (framebuffer, &old_modelview);
/* let's draw offscreen */
cogl_push_framebuffer (priv->offscreen);
clutter_paint_context_push_framebuffer (paint_context, priv->offscreen);
/* We don't want the FBO contents to be transformed. That could waste memory
* (e.g. during zoom), or result in something that's not rectangular (clipped
@ -387,7 +387,8 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
@ -417,7 +418,8 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglMatrix modelview;
float resource_scale;
@ -465,9 +467,9 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect,
/* Restore the previous opacity override */
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
framebuffer = cogl_get_draw_framebuffer ();
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_pop_matrix (framebuffer);
cogl_pop_framebuffer ();
clutter_paint_context_pop_framebuffer (paint_context);
clutter_offscreen_effect_paint_texture (self, paint_context);
}

View File

@ -44,6 +44,7 @@
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-nodes.h"
@ -108,7 +109,7 @@ clutter_root_node_pre_draw (ClutterPaintNode *node,
{
ClutterRootNode *rnode = (ClutterRootNode *) node;
cogl_push_framebuffer (rnode->framebuffer);
clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer);
cogl_framebuffer_clear (rnode->framebuffer,
rnode->clear_flags,
@ -121,7 +122,7 @@ static void
clutter_root_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
cogl_pop_framebuffer ();
clutter_paint_context_pop_framebuffer (paint_context);
}
static void
@ -205,7 +206,8 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_push_matrix (fb);
cogl_framebuffer_transform (fb, &transform_node->transform);
@ -217,7 +219,8 @@ static void
clutter_transform_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_pop_matrix (fb);
}
@ -411,7 +414,8 @@ clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
}
static CoglFramebuffer *
get_target_framebuffer (ClutterPaintNode *node)
get_target_framebuffer (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
CoglFramebuffer *framebuffer;
@ -419,7 +423,7 @@ get_target_framebuffer (ClutterPaintNode *node)
if (framebuffer)
return framebuffer;
return cogl_get_draw_framebuffer ();
return clutter_paint_context_get_framebuffer (paint_context);
}
static void
@ -436,7 +440,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
for (i = 0; i < node->operations->len; i++)
{
@ -828,7 +832,7 @@ clutter_text_node_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
fb = get_target_framebuffer (node);
fb = get_target_framebuffer (node, paint_context);
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
@ -1014,7 +1018,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return FALSE;
fb = get_target_framebuffer (node);
fb = get_target_framebuffer (node, paint_context);
for (i = 0; i < node->operations->len; i++)
{
@ -1058,7 +1062,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
fb = get_target_framebuffer (node);
fb = get_target_framebuffer (node, paint_context);
for (i = 0; i < node->operations->len; i++)
{
@ -1272,10 +1276,10 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
/* copy the same modelview from the current framebuffer to the one we
* are going to use
*/
framebuffer = cogl_get_draw_framebuffer ();
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
cogl_push_framebuffer (lnode->offscreen);
clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen);
cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
@ -1312,9 +1316,9 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
/* switch to the previous framebuffer */
cogl_framebuffer_pop_matrix (lnode->offscreen);
cogl_pop_framebuffer ();
clutter_paint_context_pop_framebuffer (paint_context);
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
for (i = 0; i < node->operations->len; i++)
{

View File

@ -2769,7 +2769,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
return NULL;
framebuffer = clutter_stage_view_get_framebuffer (view);
cogl_push_framebuffer (framebuffer);
clutter_stage_do_paint_view (stage, view, &clip_rect);
view_scale = clutter_stage_view_get_scale (view);
@ -2784,8 +2783,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
COGL_PIXEL_FORMAT_RGBA_8888,
pixels);
cogl_pop_framebuffer ();
return pixels;
}
@ -4414,7 +4411,6 @@ capture_view_into (ClutterStage *stage,
if (paint)
{
cogl_push_framebuffer (framebuffer);
_clutter_stage_maybe_setup_viewport (stage, view);
clutter_stage_do_paint_view (stage, view, rect);
}
@ -4439,9 +4435,6 @@ capture_view_into (ClutterStage *stage,
COGL_READ_PIXELS_COLOR_BUFFER,
bitmap);
if (paint)
cogl_pop_framebuffer ();
cogl_object_unref (bitmap);
}

View File

@ -2567,7 +2567,7 @@ clutter_text_paint (ClutterActor *self,
float alloc_height;
float resource_scale;
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
/* Note that if anything in this paint method changes it needs to be
reflected in the get_paint_volume implementation which is tightly

View File

@ -869,7 +869,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
}
cogl_push_framebuffer (fb);
if (use_clipped_redraw && clip_region_empty)
{
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
@ -960,7 +959,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cairo_region_destroy (view_region);
}
}
cogl_pop_framebuffer ();
cairo_region_get_extents (redraw_clip, &redraw_rect);

View File

@ -82,7 +82,8 @@ clutter_rectangle_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
static CoglPipeline *default_color_pipeline = NULL;
CoglPipeline *content_pipeline;
ClutterActorBox alloc;

View File

@ -119,14 +119,18 @@ meta_overlay_set (MetaOverlay *overlay,
}
static void
meta_overlay_paint (MetaOverlay *overlay)
meta_overlay_paint (MetaOverlay *overlay,
ClutterPaintContext *paint_context)
{
CoglFramebuffer *framebuffer;
if (!overlay->enabled)
return;
g_assert (meta_is_wayland_compositor ());
cogl_framebuffer_draw_rectangle (cogl_get_draw_framebuffer (),
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_draw_rectangle (framebuffer,
overlay->pipeline,
overlay->current_rect.origin.x,
overlay->current_rect.origin.y,
@ -198,7 +202,7 @@ meta_stage_paint (ClutterActor *actor,
g_signal_emit (stage, signals[ACTORS_PAINTED], 0);
for (l = stage->overlays; l; l = l->next)
meta_overlay_paint (l->data);
meta_overlay_paint (l->data, paint_context);
notify_watchers_for_mode (stage, stage->current_view,
META_STAGE_WATCH_AFTER_OVERLAY_PAINT);

View File

@ -337,6 +337,7 @@ make_pipeline (PipelineFlags pipeline_flags)
static void
setup_pipeline (MetaBackgroundActor *self,
ClutterPaintContext *paint_context,
cairo_rectangle_int_t *actor_pixel_rect)
{
PipelineFlags pipeline_flags = 0;
@ -436,7 +437,7 @@ setup_pipeline (MetaBackgroundActor *self,
color_component,
opacity / 255.);
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
if (!self->force_bilinear &&
meta_actor_painting_untransformed (fb,
actor_pixel_rect->width,
@ -526,14 +527,14 @@ meta_background_actor_paint (ClutterActor *actor,
actor_pixel_rect.width = actor_box.x2 - actor_box.x1;
actor_pixel_rect.height = actor_box.y2 - actor_box.y1;
setup_pipeline (self, &actor_pixel_rect);
setup_pipeline (self, paint_context, &actor_pixel_rect);
set_glsl_parameters (self, &actor_pixel_rect);
/* Limit to how many separate rectangles we'll draw; beyond this just
* fall back and draw the whole thing */
#define MAX_RECTS 64
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
/* Now figure out what to actually paint.
*/

View File

@ -512,12 +512,12 @@ texture_is_idle_and_not_mipmapped (gpointer user_data)
}
static void
do_paint_content (MetaShapedTexture *stex,
ClutterPaintNode *root_node,
CoglTexture *paint_tex,
ClutterActorBox *alloc,
uint8_t opacity)
do_paint_content (MetaShapedTexture *stex,
ClutterPaintNode *root_node,
ClutterPaintContext *paint_context,
CoglTexture *paint_tex,
ClutterActorBox *alloc,
uint8_t opacity)
{
int dst_width, dst_height;
cairo_rectangle_int_t content_rect;
@ -550,7 +550,7 @@ do_paint_content (MetaShapedTexture *stex,
framebuffer = clutter_paint_node_get_framebuffer (root_node);
if (!framebuffer)
framebuffer = cogl_get_draw_framebuffer ();
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
if (meta_actor_painting_untransformed (framebuffer,
dst_width, dst_height,
NULL, NULL))
@ -680,7 +680,8 @@ do_paint_content (MetaShapedTexture *stex,
}
static CoglTexture *
select_texture_for_paint (MetaShapedTexture *stex)
select_texture_for_paint (MetaShapedTexture *stex,
ClutterPaintContext *paint_context)
{
CoglTexture *texture = NULL;
int64_t now;
@ -696,7 +697,10 @@ select_texture_for_paint (MetaShapedTexture *stex)
if (age >= MIN_MIPMAP_AGE_USEC ||
stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
texture = meta_texture_tower_get_paint_texture (stex->paint_tower);
{
texture = meta_texture_tower_get_paint_texture (stex->paint_tower,
paint_context);
}
}
if (!texture)
@ -745,14 +749,14 @@ meta_shaped_texture_paint_content (ClutterContent *content,
* Setting the texture quality to high without SGIS_generate_mipmap
* support for TFP textures will result in fallbacks to XGetImage.
*/
paint_tex = select_texture_for_paint (stex);
paint_tex = select_texture_for_paint (stex, paint_context);
if (!paint_tex)
return;
opacity = clutter_actor_get_paint_opacity (actor);
clutter_actor_get_content_box (actor, &alloc);
do_paint_content (stex, root_node, paint_tex, &alloc, opacity);
do_paint_content (stex, root_node, paint_context, paint_tex, &alloc, opacity);
}
static gboolean
@ -1242,7 +1246,7 @@ get_image_via_offscreen (MetaShapedTexture *stex,
paint_context = clutter_paint_context_new_for_framebuffer (fb);
do_paint_content (stex, root_node,
do_paint_content (stex, root_node, paint_context,
stex->texture,
&(ClutterActorBox) {
0, 0,

View File

@ -243,7 +243,9 @@ meta_texture_tower_update_area (MetaTextureTower *tower,
* Meta.
*/
static int
get_paint_level (int width, int height)
get_paint_level (ClutterPaintContext *paint_context,
int width,
int height)
{
CoglFramebuffer *framebuffer;
CoglMatrix projection, modelview, pm;
@ -272,7 +274,7 @@ get_paint_level (int width, int height)
* (w_c) (w_o) (1)
*/
framebuffer = cogl_get_draw_framebuffer ();
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_get_projection_matrix (framebuffer, &projection);
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
@ -419,6 +421,7 @@ texture_tower_revalidate (MetaTextureTower *tower,
/**
* meta_texture_tower_get_paint_texture:
* @tower: a #MetaTextureTower
* @paint_context: a #ClutterPaintContext
*
* Gets the texture from the tower that best matches the current
* rendering scale. (On the assumption here the texture is going to
@ -430,7 +433,8 @@ texture_tower_revalidate (MetaTextureTower *tower,
* %NULL if no base texture has yet been set.
*/
CoglTexture *
meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
meta_texture_tower_get_paint_texture (MetaTextureTower *tower,
ClutterPaintContext *paint_context)
{
int texture_width, texture_height;
int level;
@ -443,7 +447,7 @@ meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
texture_width = cogl_texture_get_width (tower->textures[0]);
texture_height = cogl_texture_get_height (tower->textures[0]);
level = get_paint_level(texture_width, texture_height);
level = get_paint_level (paint_context, texture_width, texture_height);
if (level < 0) /* singular paint matrix, scaled to nothing */
return NULL;
level = MIN (level, tower->n_levels - 1);

View File

@ -60,7 +60,8 @@ void meta_texture_tower_update_area (MetaTextureTower *tower,
int y,
int width,
int height);
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower);
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower,
ClutterPaintContext *paint_context);
G_END_DECLS

View File

@ -1168,6 +1168,7 @@ meta_window_actor_x11_paint (ClutterActor *actor,
MetaShadowParams params;
cairo_rectangle_int_t shape_bounds;
cairo_region_t *clip = actor_x11->shadow_clip;
CoglFramebuffer *framebuffer;
get_shape_bounds (actor_x11, &shape_bounds);
get_shadow_params (actor_x11, appears_focused, &params);
@ -1188,8 +1189,9 @@ meta_window_actor_x11_paint (ClutterActor *actor,
cairo_region_subtract (clip, frame_bounds);
}
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
meta_shadow_paint (shadow,
cogl_get_draw_framebuffer (),
framebuffer,
params.x_offset + shape_bounds.x,
params.y_offset + shape_bounds.y,
shape_bounds.width,

View File

@ -1403,8 +1403,6 @@ meta_window_actor_get_image (MetaWindowActor *self,
cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
clutter_actor_get_position (actor, &x, &y);
cogl_push_framebuffer (framebuffer);
cogl_framebuffer_clear (framebuffer, COGL_BUFFER_BIT_COLOR, &clear_color);
cogl_framebuffer_orthographic (framebuffer, 0, 0, width, height, 0, 1.0);
cogl_framebuffer_scale (framebuffer, resource_scale, resource_scale, 1);
@ -1414,8 +1412,6 @@ meta_window_actor_get_image (MetaWindowActor *self,
clutter_actor_paint (actor, paint_context);
clutter_paint_context_destroy (paint_context);
cogl_pop_framebuffer ();
if (clip)
{
meta_rectangle_scale_double (clip, resource_scale,

View File

@ -83,7 +83,7 @@ meta_window_group_paint (ClutterActor *actor,
{
CoglFramebuffer *fb;
fb = cogl_get_draw_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
if (!meta_actor_painting_untransformed (fb,
screen_width,
screen_height,

View File

@ -58,7 +58,7 @@ foo_actor_paint (ClutterActor *actor,
255, 0, 0,
foo_actor->last_paint_opacity);
framebuffer = cogl_get_draw_framebuffer ();
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_draw_rectangle (framebuffer,
pipeline,
allocation.x1,

View File

@ -147,7 +147,7 @@ key_group_paint (ClutterActor *actor,
pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color4ub (pipeline, 255, 255, 0, 224);
framebuffer = cogl_get_draw_framebuffer ();
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
clutter_actor_iter_init (&iter, actor);
while (clutter_actor_iter_next (&iter, &child))

View File

@ -157,7 +157,8 @@ key_group_paint (ClutterActor *actor,
ClutterActorIter iter;
ClutterActor *child;
gint i = 0;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
CoglPipeline *pipeline;

View File

@ -87,7 +87,8 @@ test_coglbox_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
gfloat texcoords[4] = { 0, 0, 1, 1 };
CoglPipeline *pipeline;

View File

@ -99,7 +99,8 @@ paint_cb (ClutterActor *stage,
ClutterPaintContext *paint_context,
Data *data)
{
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglMatrix old_matrix, new_matrix;
int i;
float diff_time;

View File

@ -87,7 +87,8 @@ test_coglbox_paint (ClutterActor *self,
{
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
CoglPipeline *pipeline;
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
gfloat texcoords[4] = { 0.0, 0.0, 1.0, 1.0 };

View File

@ -197,7 +197,8 @@ test_coglbox_paint (ClutterActor *self,
: priv->not_sliced_tex;
int tex_width = cogl_texture_get_width (tex_handle);
int tex_height = cogl_texture_get_height (tex_handle);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglHandle material = cogl_material_new ();
cogl_material_set_layer (material, 0, tex_handle);

View File

@ -87,7 +87,8 @@ test_coglbox_paint (ClutterActor *self,
ClutterPaintContext *paint_context)
{
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
CoglPipeline *pipeline;
gfloat texcoords[4] = { 0.0f, 0.0f, 1.0f, 1.0f };

View File

@ -148,7 +148,8 @@ hand_pre_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
gpointer user_data)
{
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
CoglPipeline *pipeline;
SuperOH *oh = user_data;
@ -176,7 +177,8 @@ hand_post_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
gpointer user_data)
{
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
CoglPipeline *pipeline;
SuperOH *oh = user_data;

View File

@ -27,14 +27,17 @@ typedef struct _TestState
int current_test;
} TestState;
typedef void (*TestCallback) (TestState *state);
typedef void (*TestCallback) (TestState *state,
ClutterPaintContext *paint_context);
static void
test_rectangles (TestState *state)
test_rectangles (TestState *state,
ClutterPaintContext *paint_context)
{
#define RECT_WIDTH 5
#define RECT_HEIGHT 5
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
int x;
int y;
@ -111,7 +114,7 @@ on_paint (ClutterActor *actor,
ClutterPaintContext *paint_context,
TestState *state)
{
tests[state->current_test] (state);
tests[state->current_test] (state, paint_context);
}
static gboolean