clutter: Include semi private cogl API

Used by mutter, but we'll need it in clutter too. This commit is to
silence type warnings that were otherwise avoided by disabling compile
time type checking.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
Jonas Ådahl 2020-05-22 22:37:47 +02:00
parent ff65c95aee
commit 31a3b1b4c5
3 changed files with 23 additions and 15 deletions

View File

@ -1412,6 +1412,7 @@ clutter_layer_node_new (const CoglMatrix *projection,
{ {
ClutterLayerNode *res; ClutterLayerNode *res;
CoglContext *context; CoglContext *context;
CoglTexture2D *tex_2d;
CoglTexture *texture; CoglTexture *texture;
CoglColor color; CoglColor color;
@ -1426,9 +1427,10 @@ clutter_layer_node_new (const CoglMatrix *projection,
/* the texture backing the FBO */ /* the texture backing the FBO */
context = clutter_backend_get_cogl_context (clutter_get_default_backend ()); context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
texture = cogl_texture_2d_new_with_size (context, tex_2d = cogl_texture_2d_new_with_size (context,
MAX (res->fbo_width, 1), MAX (res->fbo_width, 1),
MAX (res->fbo_height, 1)); MAX (res->fbo_height, 1));
texture = COGL_TEXTURE (tex_2d);
cogl_texture_set_premultiplied (texture, TRUE); cogl_texture_set_premultiplied (texture, TRUE);
res->offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (texture)); res->offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (texture));

View File

@ -108,9 +108,9 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
if (priv->offscreen) if (priv->offscreen)
return priv->offscreen; return COGL_FRAMEBUFFER (priv->offscreen);
else if (priv->shadow.framebuffer) else if (priv->shadow.framebuffer)
return priv->shadow.framebuffer; return COGL_FRAMEBUFFER (priv->shadow.framebuffer);
else else
return priv->framebuffer; return priv->framebuffer;
} }
@ -133,8 +133,9 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
} }
static CoglPipeline * static CoglPipeline *
clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer) clutter_stage_view_create_offscreen_pipeline (CoglOffscreen *offscreen)
{ {
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
CoglPipeline *pipeline; CoglPipeline *pipeline;
pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer)); pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
@ -143,7 +144,7 @@ clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer)
COGL_PIPELINE_FILTER_NEAREST, COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST); COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (pipeline, 0, cogl_pipeline_set_layer_texture (pipeline, 0,
cogl_offscreen_get_texture (framebuffer)); cogl_offscreen_get_texture (offscreen));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE); COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
@ -164,7 +165,7 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
return; return;
priv->offscreen_pipeline = priv->offscreen_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->offscreen); clutter_stage_view_create_offscreen_pipeline (priv->offscreen);
if (view_class->setup_offscreen_blit_pipeline) if (view_class->setup_offscreen_blit_pipeline)
view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline); view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
@ -198,7 +199,7 @@ clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view
static void static void
paint_transformed_framebuffer (ClutterStageView *view, paint_transformed_framebuffer (ClutterStageView *view,
CoglPipeline *pipeline, CoglPipeline *pipeline,
CoglFramebuffer *src_framebuffer, CoglOffscreen *src_framebuffer,
CoglFramebuffer *dst_framebuffer, CoglFramebuffer *dst_framebuffer,
const cairo_region_t *redraw_clip) const cairo_region_t *redraw_clip)
{ {
@ -438,10 +439,13 @@ clutter_stage_view_after_paint (ClutterStageView *view,
if (priv->shadow.framebuffer) if (priv->shadow.framebuffer)
{ {
CoglFramebuffer *shadowfb =
COGL_FRAMEBUFFER (priv->shadow.framebuffer);
paint_transformed_framebuffer (view, paint_transformed_framebuffer (view,
priv->offscreen_pipeline, priv->offscreen_pipeline,
priv->offscreen, priv->offscreen,
priv->shadow.framebuffer, shadowfb,
redraw_clip); redraw_clip);
} }
else else
@ -514,7 +518,7 @@ find_damaged_tiles (ClutterStageView *view,
stride = cogl_dma_buf_handle_get_stride (current_dma_buf_handle); stride = cogl_dma_buf_handle_get_stride (current_dma_buf_handle);
bpp = cogl_dma_buf_handle_get_bpp (current_dma_buf_handle); bpp = cogl_dma_buf_handle_get_bpp (current_dma_buf_handle);
cogl_framebuffer_finish (priv->shadow.framebuffer); cogl_framebuffer_finish (COGL_FRAMEBUFFER (priv->shadow.framebuffer));
if (!cogl_dma_buf_handle_sync_read_start (prev_dma_buf_handle, error)) if (!cogl_dma_buf_handle_sync_read_start (prev_dma_buf_handle, error))
return NULL; return NULL;
@ -607,7 +611,7 @@ swap_dma_buf_framebuffer (ClutterStageView *view)
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
int next_idx; int next_idx;
CoglDmaBufHandle *next_dma_buf_handle; CoglDmaBufHandle *next_dma_buf_handle;
CoglOffscreen *next_framebuffer; CoglFramebuffer *next_framebuffer;
next_idx = ((priv->shadow.dma_buf.current_idx + 1) % next_idx = ((priv->shadow.dma_buf.current_idx + 1) %
G_N_ELEMENTS (priv->shadow.dma_buf.handles)); G_N_ELEMENTS (priv->shadow.dma_buf.handles));
@ -703,12 +707,13 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
for (i = 0; i < cairo_region_num_rectangles (damage_region); i++) for (i = 0; i < cairo_region_num_rectangles (damage_region); i++)
{ {
CoglFramebuffer *shadowfb = COGL_FRAMEBUFFER (priv->shadow.framebuffer);
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
cairo_region_get_rectangle (damage_region, i, &rect); cairo_region_get_rectangle (damage_region, i, &rect);
if (!cogl_blit_framebuffer (priv->shadow.framebuffer, if (!cogl_blit_framebuffer (shadowfb,
priv->framebuffer, priv->framebuffer,
rect.x, rect.y, rect.x, rect.y,
rect.x, rect.y, rect.x, rect.y,
@ -760,7 +765,7 @@ clutter_stage_view_foreach_front_buffer (ClutterStageView *view,
if (priv->offscreen) if (priv->offscreen)
{ {
callback (priv->offscreen, user_data); callback (COGL_FRAMEBUFFER (priv->offscreen), user_data);
} }
else if (priv->shadow.framebuffer) else if (priv->shadow.framebuffer)
{ {
@ -779,7 +784,7 @@ clutter_stage_view_foreach_front_buffer (ClutterStageView *view,
} }
else else
{ {
callback (priv->shadow.framebuffer, user_data); callback (COGL_FRAMEBUFFER (priv->shadow.framebuffer), user_data);
} }
} }
else else

View File

@ -8,6 +8,7 @@ clutter_c_args = [
'-DCLUTTER_SYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)), '-DCLUTTER_SYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)),
'-DCLUTTER_COMPILATION=1', '-DCLUTTER_COMPILATION=1',
'-DCOGL_DISABLE_DEPRECATION_WARNINGS', '-DCOGL_DISABLE_DEPRECATION_WARNINGS',
'-DCOGL_ENABLE_MUTTER_API',
'-DG_LOG_DOMAIN="Clutter"', '-DG_LOG_DOMAIN="Clutter"',
] ]