mirror of
https://github.com/brl/mutter.git
synced 2025-08-01 14:15:30 +00:00
Port to MtkRegion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
This commit is contained in:

committed by
Marge Bot

parent
7c98910488
commit
655b4a9c75
@@ -24,7 +24,7 @@
|
||||
|
||||
struct _ClutterDamageHistory
|
||||
{
|
||||
cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
|
||||
MtkRegion *damages[DAMAGE_HISTORY_LENGTH];
|
||||
int index;
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ clutter_damage_history_free (ClutterDamageHistory *history)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
|
||||
g_clear_pointer (&history->damages[i], cairo_region_destroy);
|
||||
g_clear_pointer (&history->damages[i], mtk_region_unref);
|
||||
|
||||
g_free (history);
|
||||
}
|
||||
@@ -65,10 +65,10 @@ clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||
|
||||
void
|
||||
clutter_damage_history_record (ClutterDamageHistory *history,
|
||||
const cairo_region_t *damage)
|
||||
const MtkRegion *damage)
|
||||
{
|
||||
g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
|
||||
history->damages[history->index] = cairo_region_copy (damage);
|
||||
g_clear_pointer (&history->damages[history->index], mtk_region_unref);
|
||||
history->damages[history->index] = mtk_region_copy (damage);
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -84,7 +84,7 @@ clutter_damage_history_step (ClutterDamageHistory *history)
|
||||
history->index = step_damage_index (history->index, 1);
|
||||
}
|
||||
|
||||
const cairo_region_t *
|
||||
const MtkRegion *
|
||||
clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age)
|
||||
{
|
||||
|
@@ -18,10 +18,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cairo.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "clutter/clutter-macros.h"
|
||||
#include "mtk/mtk.h"
|
||||
|
||||
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
||||
|
||||
@@ -37,11 +37,11 @@ gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_damage_history_record (ClutterDamageHistory *history,
|
||||
const cairo_region_t *damage);
|
||||
const MtkRegion *damage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_damage_history_step (ClutterDamageHistory *history);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age);
|
||||
const MtkRegion * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age);
|
||||
|
@@ -115,7 +115,7 @@ void clutter_stage_update_device (ClutterStage *stage,
|
||||
graphene_point_t point,
|
||||
uint32_t time,
|
||||
ClutterActor *new_actor,
|
||||
cairo_region_t *region,
|
||||
MtkRegion *region,
|
||||
gboolean emit_crossing);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
@@ -20,10 +20,10 @@
|
||||
#include "clutter/clutter-paint-context.h"
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
GArray *clip_frusta,
|
||||
ClutterPaintFlag paint_flags);
|
||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
GArray *clip_frusta,
|
||||
ClutterPaintFlag paint_flags);
|
||||
|
||||
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
||||
|
||||
|
@@ -31,7 +31,7 @@ struct _ClutterPaintContext
|
||||
ClutterStageView *view;
|
||||
ClutterFrame *frame;
|
||||
|
||||
cairo_region_t *redraw_clip;
|
||||
MtkRegion *redraw_clip;
|
||||
GArray *clip_frusta;
|
||||
};
|
||||
|
||||
@@ -40,10 +40,10 @@ G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
|
||||
clutter_paint_context_unref)
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
GArray *clip_frusta,
|
||||
ClutterPaintFlag paint_flags)
|
||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
GArray *clip_frusta,
|
||||
ClutterPaintFlag paint_flags)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
CoglFramebuffer *framebuffer;
|
||||
@@ -51,7 +51,7 @@ clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
paint_context->view = view;
|
||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
||||
paint_context->redraw_clip = mtk_region_copy (redraw_clip);
|
||||
paint_context->clip_frusta = g_array_ref (clip_frusta);
|
||||
paint_context->paint_flags = paint_flags;
|
||||
|
||||
@@ -65,15 +65,15 @@ clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
* clutter_paint_context_new_for_framebuffer: (skip)
|
||||
*/
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterPaintFlag paint_flags)
|
||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterPaintFlag paint_flags)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
||||
paint_context->redraw_clip = mtk_region_copy (redraw_clip);
|
||||
paint_context->paint_flags = paint_flags;
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
@@ -93,7 +93,7 @@ clutter_paint_context_dispose (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_list_free_full (paint_context->framebuffers, g_object_unref);
|
||||
paint_context->framebuffers = NULL;
|
||||
g_clear_pointer (&paint_context->redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&paint_context->redraw_clip, mtk_region_unref);
|
||||
g_clear_pointer (&paint_context->clip_frusta, g_array_unref);
|
||||
g_clear_pointer (&paint_context->frame, clutter_frame_unref);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
|
||||
paint_context->framebuffers);
|
||||
}
|
||||
|
||||
const cairo_region_t *
|
||||
const MtkRegion *
|
||||
clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return paint_context->redraw_clip;
|
||||
|
@@ -42,9 +42,9 @@ CLUTTER_EXPORT
|
||||
GType clutter_paint_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterPaintFlag paint_flags);
|
||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterPaintFlag paint_flags);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
||||
@@ -69,7 +69,7 @@ CLUTTER_EXPORT
|
||||
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
||||
const MtkRegion * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
|
||||
|
@@ -61,7 +61,7 @@ ClutterActor *
|
||||
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
||||
const graphene_point3d_t *point,
|
||||
const graphene_ray_t *ray,
|
||||
cairo_region_t **clear_area);
|
||||
MtkRegion **clear_area);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPickStack, clutter_pick_stack_unref)
|
||||
|
||||
|
@@ -455,9 +455,9 @@ static void
|
||||
calculate_clear_area (ClutterPickStack *pick_stack,
|
||||
PickRecord *pick_rec,
|
||||
int elem,
|
||||
cairo_region_t **clear_area)
|
||||
MtkRegion **clear_area)
|
||||
{
|
||||
cairo_region_t *area = NULL;
|
||||
MtkRegion *area = NULL;
|
||||
graphene_point3d_t verts[4];
|
||||
MtkRectangle rect;
|
||||
int i;
|
||||
@@ -478,7 +478,7 @@ calculate_clear_area (ClutterPickStack *pick_stack,
|
||||
rect.height =
|
||||
MIN (rect.height, floor (pick_rec->base.rect.y2 - pick_rec->base.rect.y1));
|
||||
|
||||
area = cairo_region_create_rectangle (&rect);
|
||||
area = mtk_region_create_rectangle (&rect);
|
||||
|
||||
for (i = elem + 1; i < pick_stack->vertices_stack->len; i++)
|
||||
{
|
||||
@@ -487,33 +487,31 @@ calculate_clear_area (ClutterPickStack *pick_stack,
|
||||
ClutterActorBox paint_box;
|
||||
|
||||
if (!rec->is_overlap &&
|
||||
(rec->base.rect.x1 == rec->base.rect.x2 ||
|
||||
rec->base.rect.y1 == rec->base.rect.y2))
|
||||
(rec->base.rect.x1 == rec->base.rect.x2 ||
|
||||
rec->base.rect.y1 == rec->base.rect.y2))
|
||||
continue;
|
||||
|
||||
if (!clutter_actor_get_paint_box (rec->actor, &paint_box))
|
||||
continue;
|
||||
|
||||
cairo_region_subtract_rectangle (area,
|
||||
&(MtkRectangle) {
|
||||
.x = paint_box.x1,
|
||||
.y = paint_box.y1,
|
||||
.width = paint_box.x2 - paint_box.x1,
|
||||
.height = paint_box.y2 - paint_box.y1,
|
||||
});
|
||||
mtk_region_subtract_rectangle (area,
|
||||
&MTK_RECTANGLE_INIT (paint_box.x1, paint_box.y1,
|
||||
paint_box.x2 - paint_box.x1,
|
||||
paint_box.y2 - paint_box.y1)
|
||||
);
|
||||
}
|
||||
|
||||
if (clear_area)
|
||||
*clear_area = g_steal_pointer (&area);
|
||||
|
||||
g_clear_pointer (&area, cairo_region_destroy);
|
||||
g_clear_pointer (&area, mtk_region_unref);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
||||
const graphene_point3d_t *point,
|
||||
const graphene_ray_t *ray,
|
||||
cairo_region_t **clear_area)
|
||||
MtkRegion **clear_area)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@@ -42,10 +42,10 @@ typedef enum
|
||||
|
||||
/* stage */
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame);
|
||||
void clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame);
|
||||
|
||||
void clutter_stage_emit_before_update (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
@@ -122,7 +122,7 @@ void clutter_stage_update_device_entry (ClutterStage *self,
|
||||
ClutterEventSequence *sequence,
|
||||
graphene_point_t coords,
|
||||
ClutterActor *actor,
|
||||
cairo_region_t *clear_area);
|
||||
MtkRegion *clear_area);
|
||||
|
||||
void clutter_stage_remove_device_entry (ClutterStage *self,
|
||||
ClutterInputDevice *device,
|
||||
|
@@ -23,11 +23,11 @@
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_view_after_paint (ClutterStageView *view,
|
||||
cairo_region_t *redraw_clip);
|
||||
MtkRegion *redraw_clip);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||
const cairo_region_t *swap_region);
|
||||
void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||
const MtkRegion *swap_region);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||
|
||||
@@ -54,13 +54,13 @@ gboolean clutter_stage_view_has_full_redraw_clip (ClutterStageView *view);
|
||||
|
||||
gboolean clutter_stage_view_has_redraw_clip (ClutterStageView *view);
|
||||
|
||||
const cairo_region_t * clutter_stage_view_peek_redraw_clip (ClutterStageView *view);
|
||||
const MtkRegion * clutter_stage_view_peek_redraw_clip (ClutterStageView *view);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
||||
MtkRegion * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
cairo_region_t * clutter_stage_view_take_accumulated_redraw_clip (ClutterStageView *view);
|
||||
MtkRegion * clutter_stage_view_take_accumulated_redraw_clip (ClutterStageView *view);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_view_accumulate_redraw_clip (ClutterStageView *view);
|
||||
|
@@ -84,9 +84,9 @@ typedef struct _ClutterStageViewPrivate
|
||||
CoglScanout *next_scanout;
|
||||
|
||||
gboolean has_redraw_clip;
|
||||
cairo_region_t *redraw_clip;
|
||||
MtkRegion *redraw_clip;
|
||||
gboolean has_accumulated_redraw_clip;
|
||||
cairo_region_t *accumulated_redraw_clip;
|
||||
MtkRegion *accumulated_redraw_clip;
|
||||
|
||||
float refresh_rate;
|
||||
int64_t vblank_duration_us;
|
||||
@@ -228,11 +228,11 @@ clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
|
||||
}
|
||||
|
||||
static void
|
||||
paint_transformed_framebuffer (ClutterStageView *view,
|
||||
CoglPipeline *pipeline,
|
||||
CoglOffscreen *src_framebuffer,
|
||||
CoglFramebuffer *dst_framebuffer,
|
||||
const cairo_region_t *redraw_clip)
|
||||
paint_transformed_framebuffer (ClutterStageView *view,
|
||||
CoglPipeline *pipeline,
|
||||
CoglOffscreen *src_framebuffer,
|
||||
CoglFramebuffer *dst_framebuffer,
|
||||
const MtkRegion *redraw_clip)
|
||||
{
|
||||
graphene_matrix_t matrix;
|
||||
unsigned int n_rectangles, i;
|
||||
@@ -246,10 +246,8 @@ paint_transformed_framebuffer (ClutterStageView *view,
|
||||
dst_height = cogl_framebuffer_get_height (dst_framebuffer);
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
clutter_stage_view_transform_rect_to_onscreen (view,
|
||||
&(MtkRectangle) {
|
||||
.width = view_layout.width,
|
||||
.height = view_layout.height,
|
||||
},
|
||||
&MTK_RECTANGLE_INIT (0, 0,
|
||||
view_layout.width, view_layout.height),
|
||||
view_layout.width,
|
||||
view_layout.height,
|
||||
&onscreen_layout);
|
||||
@@ -269,7 +267,7 @@ paint_transformed_framebuffer (ClutterStageView *view,
|
||||
cogl_framebuffer_set_viewport (dst_framebuffer,
|
||||
0, 0, dst_width, dst_height);
|
||||
|
||||
n_rectangles = cairo_region_num_rectangles (redraw_clip);
|
||||
n_rectangles = mtk_region_num_rectangles (redraw_clip);
|
||||
coordinates = g_newa (float, 2 * 4 * n_rectangles);
|
||||
|
||||
for (i = 0; i < n_rectangles; i++)
|
||||
@@ -277,7 +275,7 @@ paint_transformed_framebuffer (ClutterStageView *view,
|
||||
MtkRectangle src_rect;
|
||||
MtkRectangle dst_rect;
|
||||
|
||||
cairo_region_get_rectangle (redraw_clip, i, &src_rect);
|
||||
src_rect = mtk_region_get_rectangle (redraw_clip, i);
|
||||
src_rect.x -= view_layout.x;
|
||||
src_rect.y -= view_layout.y;
|
||||
|
||||
@@ -463,7 +461,7 @@ init_shadowfb (ClutterStageView *view)
|
||||
|
||||
void
|
||||
clutter_stage_view_after_paint (ClutterStageView *view,
|
||||
cairo_region_t *redraw_clip)
|
||||
MtkRegion *redraw_clip)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
@@ -520,14 +518,14 @@ flip_dma_buf_idx (int idx)
|
||||
return (idx + 1) % 2;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
find_damaged_tiles (ClutterStageView *view,
|
||||
const cairo_region_t *damage_region,
|
||||
GError **error)
|
||||
static MtkRegion *
|
||||
find_damaged_tiles (ClutterStageView *view,
|
||||
const MtkRegion *damage_region,
|
||||
GError **error)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
cairo_region_t *tile_damage_region;
|
||||
MtkRegion *tile_damage_region;
|
||||
MtkRectangle damage_extents;
|
||||
MtkRectangle fb_rect;
|
||||
int prev_dma_buf_idx;
|
||||
@@ -573,7 +571,7 @@ find_damaged_tiles (ClutterStageView *view,
|
||||
.height = height,
|
||||
};
|
||||
|
||||
cairo_region_get_extents (damage_region, &damage_extents);
|
||||
damage_extents = mtk_region_get_extents (damage_region);
|
||||
|
||||
tile_x_min = damage_extents.x / tile_size;
|
||||
tile_x_max = ((damage_extents.x + damage_extents.width + tile_size - 1) /
|
||||
@@ -582,7 +580,7 @@ find_damaged_tiles (ClutterStageView *view,
|
||||
tile_y_max = ((damage_extents.y + damage_extents.height + tile_size - 1) /
|
||||
tile_size);
|
||||
|
||||
tile_damage_region = cairo_region_create ();
|
||||
tile_damage_region = mtk_region_create ();
|
||||
|
||||
for (tile_y = tile_y_min; tile_y <= tile_y_max; tile_y++)
|
||||
{
|
||||
@@ -595,14 +593,14 @@ find_damaged_tiles (ClutterStageView *view,
|
||||
.height = tile_size,
|
||||
};
|
||||
|
||||
if (cairo_region_contains_rectangle (damage_region, &tile) ==
|
||||
CAIRO_REGION_OVERLAP_OUT)
|
||||
if (mtk_region_contains_rectangle (damage_region, &tile) ==
|
||||
MTK_REGION_OVERLAP_OUT)
|
||||
continue;
|
||||
|
||||
mtk_rectangle_intersect (&tile, &fb_rect, &tile);
|
||||
|
||||
if (is_tile_dirty (&tile, current_data, prev_data, bpp, stride))
|
||||
cairo_region_union_rectangle (tile_damage_region, &tile);
|
||||
mtk_region_union_rectangle (tile_damage_region, &tile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +621,7 @@ find_damaged_tiles (ClutterStageView *view,
|
||||
cogl_dma_buf_handle_munmap (prev_dma_buf_handle, prev_data, NULL);
|
||||
cogl_dma_buf_handle_munmap (current_dma_buf_handle, current_data, NULL);
|
||||
|
||||
cairo_region_intersect (tile_damage_region, damage_region);
|
||||
mtk_region_intersect (tile_damage_region, damage_region);
|
||||
|
||||
return tile_damage_region;
|
||||
|
||||
@@ -660,33 +658,33 @@ swap_dma_buf_framebuffer (ClutterStageView *view)
|
||||
}
|
||||
|
||||
static void
|
||||
copy_shadowfb_to_onscreen (ClutterStageView *view,
|
||||
const cairo_region_t *swap_region)
|
||||
copy_shadowfb_to_onscreen (ClutterStageView *view,
|
||||
const MtkRegion *swap_region)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
ClutterDamageHistory *damage_history = priv->shadow.dma_buf.damage_history;
|
||||
cairo_region_t *damage_region;
|
||||
g_autoptr (MtkRegion) damage_region = NULL;
|
||||
int age;
|
||||
int i;
|
||||
|
||||
if (cairo_region_is_empty (swap_region))
|
||||
if (mtk_region_is_empty (swap_region))
|
||||
{
|
||||
MtkRectangle full_damage = {
|
||||
.width = cogl_framebuffer_get_width (priv->framebuffer),
|
||||
.height = cogl_framebuffer_get_height (priv->framebuffer),
|
||||
};
|
||||
damage_region = cairo_region_create_rectangle (&full_damage);
|
||||
damage_region = mtk_region_create_rectangle (&full_damage);
|
||||
}
|
||||
else
|
||||
{
|
||||
damage_region = cairo_region_copy (swap_region);
|
||||
damage_region = mtk_region_copy (swap_region);
|
||||
}
|
||||
|
||||
if (is_shadowfb_double_buffered (view))
|
||||
{
|
||||
CoglOnscreen *onscreen = COGL_ONSCREEN (priv->framebuffer);
|
||||
cairo_region_t *changed_region;
|
||||
g_autoptr (MtkRegion) changed_region = NULL;
|
||||
|
||||
if (cogl_onscreen_get_frame_counter (onscreen) >= 1)
|
||||
{
|
||||
@@ -708,7 +706,7 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
|
||||
}
|
||||
else
|
||||
{
|
||||
changed_region = cairo_region_copy (damage_region);
|
||||
changed_region = mtk_region_copy (damage_region);
|
||||
}
|
||||
|
||||
if (changed_region)
|
||||
@@ -722,31 +720,27 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
|
||||
{
|
||||
for (age = 1; age <= buffer_age; age++)
|
||||
{
|
||||
const cairo_region_t *old_damage;
|
||||
const MtkRegion *old_damage;
|
||||
|
||||
old_damage = clutter_damage_history_lookup (damage_history, age);
|
||||
cairo_region_union (changed_region, old_damage);
|
||||
mtk_region_union (changed_region, old_damage);
|
||||
}
|
||||
|
||||
cairo_region_destroy (damage_region);
|
||||
g_clear_pointer (&damage_region, mtk_region_unref);
|
||||
damage_region = g_steal_pointer (&changed_region);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_region_destroy (changed_region);
|
||||
}
|
||||
|
||||
clutter_damage_history_step (damage_history);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < cairo_region_num_rectangles (damage_region); i++)
|
||||
for (i = 0; i < mtk_region_num_rectangles (damage_region); i++)
|
||||
{
|
||||
CoglFramebuffer *shadowfb = COGL_FRAMEBUFFER (priv->shadow.framebuffer);
|
||||
g_autoptr (GError) error = NULL;
|
||||
MtkRectangle rect;
|
||||
|
||||
cairo_region_get_rectangle (damage_region, i, &rect);
|
||||
rect = mtk_region_get_rectangle (damage_region, i);
|
||||
|
||||
if (!cogl_blit_framebuffer (shadowfb,
|
||||
priv->framebuffer,
|
||||
@@ -756,20 +750,17 @@ copy_shadowfb_to_onscreen (ClutterStageView *view,
|
||||
&error))
|
||||
{
|
||||
g_warning ("Failed to blit shadow buffer: %s", error->message);
|
||||
cairo_region_destroy (damage_region);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cairo_region_destroy (damage_region);
|
||||
|
||||
if (is_shadowfb_double_buffered (view))
|
||||
swap_dma_buf_framebuffer (view);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||
const cairo_region_t *swap_region)
|
||||
clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||
const MtkRegion *swap_region)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
@@ -930,18 +921,18 @@ clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
||||
|
||||
static void
|
||||
maybe_mark_full_redraw (ClutterStageView *view,
|
||||
cairo_region_t **region)
|
||||
MtkRegion **region)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
if (cairo_region_num_rectangles (*region) == 1)
|
||||
if (mtk_region_num_rectangles (*region) == 1)
|
||||
{
|
||||
MtkRectangle region_extents;
|
||||
|
||||
cairo_region_get_extents (*region, ®ion_extents);
|
||||
region_extents = mtk_region_get_extents (*region);
|
||||
if (mtk_rectangle_equal (&priv->layout, ®ion_extents))
|
||||
g_clear_pointer (region, cairo_region_destroy);
|
||||
g_clear_pointer (region, mtk_region_unref);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,7 +948,7 @@ clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||
|
||||
if (!clip)
|
||||
{
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||
priv->has_redraw_clip = TRUE;
|
||||
return;
|
||||
}
|
||||
@@ -968,11 +959,11 @@ clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||
if (!priv->redraw_clip)
|
||||
{
|
||||
if (!mtk_rectangle_equal (&priv->layout, clip))
|
||||
priv->redraw_clip = cairo_region_create_rectangle (clip);
|
||||
priv->redraw_clip = mtk_region_create_rectangle (clip);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_region_union_rectangle (priv->redraw_clip, clip);
|
||||
mtk_region_union_rectangle (priv->redraw_clip, clip);
|
||||
maybe_mark_full_redraw (view, &priv->redraw_clip);
|
||||
}
|
||||
|
||||
@@ -997,7 +988,7 @@ clutter_stage_view_has_full_redraw_clip (ClutterStageView *view)
|
||||
return priv->has_redraw_clip && !priv->redraw_clip;
|
||||
}
|
||||
|
||||
const cairo_region_t *
|
||||
const MtkRegion *
|
||||
clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
@@ -1006,7 +997,7 @@ clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
|
||||
return priv->redraw_clip;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
MtkRegion *
|
||||
clutter_stage_view_take_redraw_clip (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
@@ -1017,7 +1008,7 @@ clutter_stage_view_take_redraw_clip (ClutterStageView *view)
|
||||
return g_steal_pointer (&priv->redraw_clip);
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
MtkRegion *
|
||||
clutter_stage_view_take_accumulated_redraw_clip (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
@@ -1041,7 +1032,7 @@ clutter_stage_view_accumulate_redraw_clip (ClutterStageView *view)
|
||||
|
||||
if (priv->redraw_clip && priv->accumulated_redraw_clip)
|
||||
{
|
||||
cairo_region_union (priv->accumulated_redraw_clip, priv->redraw_clip);
|
||||
mtk_region_union (priv->accumulated_redraw_clip, priv->redraw_clip);
|
||||
maybe_mark_full_redraw (view, &priv->accumulated_redraw_clip);
|
||||
}
|
||||
else if (priv->redraw_clip && !priv->has_accumulated_redraw_clip)
|
||||
@@ -1050,10 +1041,10 @@ clutter_stage_view_accumulate_redraw_clip (ClutterStageView *view)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_clear_pointer (&priv->accumulated_redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->accumulated_redraw_clip, mtk_region_unref);
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||
priv->has_accumulated_redraw_clip = TRUE;
|
||||
priv->has_redraw_clip = FALSE;
|
||||
}
|
||||
@@ -1486,8 +1477,8 @@ clutter_stage_view_dispose (GObject *object)
|
||||
|
||||
g_clear_object (&priv->offscreen);
|
||||
g_clear_object (&priv->offscreen_pipeline);
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->accumulated_redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||
g_clear_pointer (&priv->accumulated_redraw_clip, mtk_region_unref);
|
||||
g_clear_pointer (&priv->frame_clock, clutter_frame_clock_destroy);
|
||||
|
||||
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#include "clutter/clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
@@ -102,7 +101,7 @@ typedef struct _PointerDeviceEntry
|
||||
ClutterEventSequence *sequence;
|
||||
graphene_point_t coords;
|
||||
ClutterActor *current_actor;
|
||||
cairo_region_t *clear_area;
|
||||
MtkRegion *clear_area;
|
||||
|
||||
unsigned int press_count;
|
||||
ClutterActor *implicit_grab_actor;
|
||||
@@ -400,10 +399,10 @@ setup_clip_frustum (ClutterStage *stage,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame,
|
||||
const cairo_region_t *redraw_clip)
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame,
|
||||
const MtkRegion *redraw_clip)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
MtkRectangle clip_rect;
|
||||
@@ -415,7 +414,7 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
int n_rectangles;
|
||||
ClutterPaintFlag paint_flags;
|
||||
|
||||
n_rectangles = redraw_clip ? cairo_region_num_rectangles (redraw_clip) : 0;
|
||||
n_rectangles = redraw_clip ? mtk_region_num_rectangles (redraw_clip) : 0;
|
||||
if (redraw_clip && n_rectangles < MAX_FRUSTA)
|
||||
{
|
||||
int i;
|
||||
@@ -426,7 +425,7 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
|
||||
for (i = 0; i < n_rectangles; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (redraw_clip, i, &clip_rect);
|
||||
clip_rect = mtk_region_get_rectangle (redraw_clip, i);
|
||||
setup_clip_frustum (stage, &clip_rect, &clip_frustum);
|
||||
g_array_append_val (clip_frusta, clip_frustum);
|
||||
}
|
||||
@@ -437,7 +436,7 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
sizeof (graphene_frustum_t),
|
||||
1);
|
||||
if (redraw_clip)
|
||||
cairo_region_get_extents (redraw_clip, &clip_rect);
|
||||
clip_rect = mtk_region_get_extents (redraw_clip);
|
||||
else
|
||||
clutter_stage_view_get_layout (view, &clip_rect);
|
||||
|
||||
@@ -475,10 +474,10 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
* for picking or painting...
|
||||
*/
|
||||
void
|
||||
clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame)
|
||||
clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
@@ -1073,7 +1072,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
float y,
|
||||
ClutterPickMode mode,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t **clear_area)
|
||||
MtkRegion **clear_area)
|
||||
{
|
||||
g_autoptr (ClutterPickStack) pick_stack = NULL;
|
||||
ClutterPickContext *pick_context;
|
||||
@@ -1127,7 +1126,7 @@ _clutter_stage_do_pick (ClutterStage *stage,
|
||||
float x,
|
||||
float y,
|
||||
ClutterPickMode mode,
|
||||
cairo_region_t **clear_area)
|
||||
MtkRegion **clear_area)
|
||||
{
|
||||
ClutterActor *actor = CLUTTER_ACTOR (stage);
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
@@ -1300,10 +1299,10 @@ clutter_stage_finalize (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame)
|
||||
clutter_stage_real_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
clutter_stage_do_paint_view (stage, view, frame, redraw_clip);
|
||||
}
|
||||
@@ -1571,7 +1570,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
* ClutterStage::paint-view:
|
||||
* @stage: the stage that received the event
|
||||
* @view: a #ClutterStageView
|
||||
* @redraw_clip: a #cairo_region_t with the redraw clip
|
||||
* @redraw_clip: a #MtkRegion with the redraw clip
|
||||
* @frame: a #ClutterFrame
|
||||
*
|
||||
* The signal is emitted before a [class@Clutter.StageView] is being
|
||||
@@ -1590,7 +1589,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
_clutter_marshal_VOID__OBJECT_BOXED_BOXED,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_STAGE_VIEW,
|
||||
CAIRO_GOBJECT_TYPE_REGION | G_SIGNAL_TYPE_STATIC_SCOPE,
|
||||
MTK_TYPE_REGION | G_SIGNAL_TYPE_STATIC_SCOPE,
|
||||
CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
g_signal_set_va_marshaller (stage_signals[PAINT_VIEW],
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
@@ -1945,7 +1944,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
ClutterActorBox box;
|
||||
GList *l;
|
||||
ClutterStageView *view;
|
||||
cairo_region_t *clip;
|
||||
g_autoptr (MtkRegion) clip = NULL;
|
||||
MtkRectangle clip_rect;
|
||||
CoglFramebuffer *framebuffer;
|
||||
float view_scale;
|
||||
@@ -1977,27 +1976,17 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
view = l->data;
|
||||
|
||||
clutter_stage_view_get_layout (view, &clip_rect);
|
||||
clip = cairo_region_create_rectangle (&clip_rect);
|
||||
cairo_region_intersect_rectangle (clip,
|
||||
&(MtkRectangle) {
|
||||
.x = x,
|
||||
.y = y,
|
||||
.width = width,
|
||||
.height = height,
|
||||
});
|
||||
cairo_region_get_extents (clip, &clip_rect);
|
||||
clip = mtk_region_create_rectangle (&clip_rect);
|
||||
mtk_region_intersect_rectangle (clip,
|
||||
&MTK_RECTANGLE_INIT (x, y, width, height));
|
||||
clip_rect = mtk_region_get_extents (clip);
|
||||
|
||||
if (clip_rect.width == 0 || clip_rect.height == 0)
|
||||
{
|
||||
cairo_region_destroy (clip);
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
clutter_stage_do_paint_view (stage, view, NULL, clip);
|
||||
|
||||
cairo_region_destroy (clip);
|
||||
|
||||
view_scale = clutter_stage_view_get_scale (view);
|
||||
pixel_width = roundf (clip_rect.width * view_scale);
|
||||
pixel_height = roundf (clip_rect.height * view_scale);
|
||||
@@ -2725,7 +2714,7 @@ clutter_stage_paint_to_framebuffer (ClutterStage *stage,
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
ClutterPaintContext *paint_context;
|
||||
cairo_region_t *redraw_clip;
|
||||
g_autoptr (MtkRegion) redraw_clip = NULL;
|
||||
|
||||
if (paint_flags & CLUTTER_PAINT_FLAG_CLEAR)
|
||||
{
|
||||
@@ -2735,12 +2724,11 @@ clutter_stage_paint_to_framebuffer (ClutterStage *stage,
|
||||
cogl_framebuffer_clear (framebuffer, COGL_BUFFER_BIT_COLOR, &clear_color);
|
||||
}
|
||||
|
||||
redraw_clip = cairo_region_create_rectangle (rect);
|
||||
redraw_clip = mtk_region_create_rectangle (rect);
|
||||
paint_context =
|
||||
clutter_paint_context_new_for_framebuffer (framebuffer,
|
||||
redraw_clip,
|
||||
paint_flags);
|
||||
cairo_region_destroy (redraw_clip);
|
||||
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
cogl_framebuffer_set_projection_matrix (framebuffer, &priv->projection);
|
||||
@@ -3048,7 +3036,7 @@ free_pointer_device_entry (PointerDeviceEntry *entry)
|
||||
if (entry->current_actor)
|
||||
_clutter_actor_set_has_pointer (entry->current_actor, FALSE);
|
||||
|
||||
g_clear_pointer (&entry->clear_area, cairo_region_destroy);
|
||||
g_clear_pointer (&entry->clear_area, mtk_region_unref);
|
||||
|
||||
g_assert (!entry->press_count);
|
||||
g_assert (entry->event_emission_chain->len == 0);
|
||||
@@ -3063,7 +3051,7 @@ clutter_stage_update_device_entry (ClutterStage *self,
|
||||
ClutterEventSequence *sequence,
|
||||
graphene_point_t coords,
|
||||
ClutterActor *actor,
|
||||
cairo_region_t *clear_area)
|
||||
MtkRegion *clear_area)
|
||||
{
|
||||
ClutterStagePrivate *priv = self->priv;
|
||||
PointerDeviceEntry *entry = NULL;
|
||||
@@ -3108,9 +3096,9 @@ clutter_stage_update_device_entry (ClutterStage *self,
|
||||
_clutter_actor_set_has_pointer (actor, TRUE);
|
||||
}
|
||||
|
||||
g_clear_pointer (&entry->clear_area, cairo_region_destroy);
|
||||
g_clear_pointer (&entry->clear_area, mtk_region_unref);
|
||||
if (clear_area)
|
||||
entry->clear_area = cairo_region_reference (clear_area);
|
||||
entry->clear_area = mtk_region_ref (clear_area);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3446,7 +3434,7 @@ clutter_stage_update_device (ClutterStage *stage,
|
||||
graphene_point_t point,
|
||||
uint32_t time_ms,
|
||||
ClutterActor *new_actor,
|
||||
cairo_region_t *clear_area,
|
||||
MtkRegion *clear_area,
|
||||
gboolean emit_crossing)
|
||||
{
|
||||
ClutterInputDeviceType device_type;
|
||||
@@ -3587,8 +3575,8 @@ clutter_stage_check_in_clear_area (ClutterStage *stage,
|
||||
if (!entry->clear_area)
|
||||
return FALSE;
|
||||
|
||||
return cairo_region_contains_point (entry->clear_area,
|
||||
point.x, point.y);
|
||||
return mtk_region_contains_point (entry->clear_area,
|
||||
point.x, point.y);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
@@ -3601,7 +3589,7 @@ clutter_stage_pick_and_update_device (ClutterStage *stage,
|
||||
uint32_t time_ms)
|
||||
{
|
||||
ClutterActor *new_actor;
|
||||
cairo_region_t *clear_area = NULL;
|
||||
MtkRegion *clear_area = NULL;
|
||||
|
||||
if ((flags & CLUTTER_DEVICE_UPDATE_IGNORE_CACHE) == 0)
|
||||
{
|
||||
@@ -3632,7 +3620,7 @@ clutter_stage_pick_and_update_device (ClutterStage *stage,
|
||||
clear_area,
|
||||
!!(flags & CLUTTER_DEVICE_UPDATE_EMIT_CROSSING));
|
||||
|
||||
g_clear_pointer (&clear_area, cairo_region_destroy);
|
||||
g_clear_pointer (&clear_area, mtk_region_unref);
|
||||
|
||||
return new_actor;
|
||||
}
|
||||
|
@@ -75,10 +75,10 @@ struct _ClutterStageClass
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame);
|
||||
|
||||
void (* paint_view) (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame);
|
||||
void (* paint_view) (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user