mirror of
https://github.com/brl/mutter.git
synced 2025-07-03 01:32:11 +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
@ -47,7 +47,7 @@
|
||||
struct _MetaPointerConstraint
|
||||
{
|
||||
GObject parent_instance;
|
||||
cairo_region_t *region;
|
||||
MtkRegion *region;
|
||||
double min_edge_distance;
|
||||
};
|
||||
|
||||
@ -61,7 +61,7 @@ meta_pointer_constraint_finalize (GObject *object)
|
||||
{
|
||||
MetaPointerConstraint *constraint = META_POINTER_CONSTRAINT (object);
|
||||
|
||||
g_clear_pointer (&constraint->region, cairo_region_destroy);
|
||||
g_clear_pointer (&constraint->region, mtk_region_unref);
|
||||
|
||||
G_OBJECT_CLASS (meta_pointer_constraint_parent_class)->finalize (object);
|
||||
}
|
||||
@ -81,19 +81,19 @@ meta_pointer_constraint_class_init (MetaPointerConstraintClass *klass)
|
||||
|
||||
|
||||
MetaPointerConstraint *
|
||||
meta_pointer_constraint_new (const cairo_region_t *region,
|
||||
double min_edge_distance)
|
||||
meta_pointer_constraint_new (const MtkRegion *region,
|
||||
double min_edge_distance)
|
||||
{
|
||||
MetaPointerConstraint *constraint;
|
||||
|
||||
constraint = g_object_new (META_TYPE_POINTER_CONSTRAINT, NULL);
|
||||
constraint->region = cairo_region_copy (region);
|
||||
constraint->region = mtk_region_copy (region);
|
||||
constraint->min_edge_distance = min_edge_distance;
|
||||
|
||||
return constraint;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
MtkRegion *
|
||||
meta_pointer_constraint_get_region (MetaPointerConstraint *constraint)
|
||||
{
|
||||
return constraint->region;
|
||||
|
@ -32,10 +32,10 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (MetaPointerConstraint, meta_pointer_constraint,
|
||||
META, POINTER_CONSTRAINT, GObject);
|
||||
|
||||
MetaPointerConstraint * meta_pointer_constraint_new (const cairo_region_t *region,
|
||||
double min_edge_distance);
|
||||
MetaPointerConstraint * meta_pointer_constraint_new (const MtkRegion *region,
|
||||
double min_edge_distance);
|
||||
|
||||
cairo_region_t * meta_pointer_constraint_get_region (MetaPointerConstraint *constraint);
|
||||
MtkRegion * meta_pointer_constraint_get_region (MetaPointerConstraint *constraint);
|
||||
|
||||
double meta_pointer_constraint_get_min_edge_distance (MetaPointerConstraint *constraint);
|
||||
|
||||
|
@ -243,11 +243,11 @@ maybe_record_frame_on_idle (gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
before_stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
before_stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaScreenCastAreaStreamSrc *area_src =
|
||||
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
|
||||
@ -263,11 +263,11 @@ before_stage_painted (MetaStage *stage,
|
||||
}
|
||||
|
||||
static void
|
||||
stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaScreenCastAreaStreamSrc *area_src =
|
||||
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
|
||||
@ -283,12 +283,12 @@ stage_painted (MetaStage *stage,
|
||||
|
||||
if (redraw_clip)
|
||||
{
|
||||
switch (cairo_region_contains_rectangle (redraw_clip, area))
|
||||
switch (mtk_region_contains_rectangle (redraw_clip, area))
|
||||
{
|
||||
case CAIRO_REGION_OVERLAP_IN:
|
||||
case CAIRO_REGION_OVERLAP_PART:
|
||||
case MTK_REGION_OVERLAP_IN:
|
||||
case MTK_REGION_OVERLAP_PART:
|
||||
break;
|
||||
case CAIRO_REGION_OVERLAP_OUT:
|
||||
case MTK_REGION_OVERLAP_OUT:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -147,11 +147,11 @@ maybe_record_frame_on_idle (gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaScreenCastMonitorStreamSrc *monitor_src =
|
||||
META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
|
||||
@ -187,11 +187,11 @@ stage_painted (MetaStage *stage,
|
||||
}
|
||||
|
||||
static void
|
||||
before_stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
before_stage_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaScreenCastMonitorStreamSrc *monitor_src =
|
||||
META_SCREEN_CAST_MONITOR_STREAM_SRC (user_data);
|
||||
|
@ -112,7 +112,7 @@ typedef struct _MetaScreenCastStreamSrcPrivate
|
||||
gboolean uses_dma_bufs;
|
||||
GHashTable *dmabuf_handles;
|
||||
|
||||
cairo_region_t *redraw_clip;
|
||||
MtkRegion *redraw_clip;
|
||||
} MetaScreenCastStreamSrcPrivate;
|
||||
|
||||
static const struct {
|
||||
@ -687,7 +687,7 @@ maybe_add_damaged_regions_metadata (MetaScreenCastStreamSrc *src,
|
||||
int num_buffers_available;
|
||||
|
||||
i = 0;
|
||||
n_rectangles = cairo_region_num_rectangles (priv->redraw_clip);
|
||||
n_rectangles = mtk_region_num_rectangles (priv->redraw_clip);
|
||||
num_buffers_available = 0;
|
||||
|
||||
spa_meta_for_each (meta_region, spa_meta_video_damage)
|
||||
@ -714,7 +714,7 @@ maybe_add_damaged_regions_metadata (MetaScreenCastStreamSrc *src,
|
||||
{
|
||||
MtkRectangle rect;
|
||||
|
||||
cairo_region_get_rectangle (priv->redraw_clip, i, &rect);
|
||||
rect = mtk_region_get_rectangle (priv->redraw_clip, i);
|
||||
meta_region->region = SPA_REGION (rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
|
||||
@ -724,13 +724,13 @@ maybe_add_damaged_regions_metadata (MetaScreenCastStreamSrc *src,
|
||||
}
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->redraw_clip, mtk_region_unref);
|
||||
}
|
||||
|
||||
MetaScreenCastRecordResult
|
||||
meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||
MetaScreenCastRecordFlag flags,
|
||||
const cairo_region_t *redraw_clip)
|
||||
const MtkRegion *redraw_clip)
|
||||
{
|
||||
int64_t now_us = g_get_monotonic_time ();
|
||||
|
||||
@ -743,7 +743,7 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||
MetaScreenCastRecordResult
|
||||
meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStreamSrc *src,
|
||||
MetaScreenCastRecordFlag flags,
|
||||
const cairo_region_t *redraw_clip,
|
||||
const MtkRegion *redraw_clip,
|
||||
int64_t frame_timestamp_us)
|
||||
{
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
@ -762,9 +762,9 @@ meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStr
|
||||
if (redraw_clip)
|
||||
{
|
||||
if (priv->redraw_clip)
|
||||
cairo_region_union (priv->redraw_clip, redraw_clip);
|
||||
mtk_region_union (priv->redraw_clip, redraw_clip);
|
||||
else
|
||||
priv->redraw_clip = cairo_region_copy (redraw_clip);
|
||||
priv->redraw_clip = mtk_region_copy (redraw_clip);
|
||||
}
|
||||
|
||||
if (priv->buffer_count == 0)
|
||||
|
@ -91,11 +91,11 @@ gboolean meta_screen_cast_stream_src_is_enabled (MetaScreenCastStreamSrc *src);
|
||||
|
||||
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
||||
MetaScreenCastRecordFlag flags,
|
||||
const cairo_region_t *redraw_clip);
|
||||
const MtkRegion *redraw_clip);
|
||||
|
||||
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStreamSrc *src,
|
||||
MetaScreenCastRecordFlag flags,
|
||||
const cairo_region_t *redraw_clip,
|
||||
const MtkRegion *redraw_clip,
|
||||
int64_t frame_timestamp_us);
|
||||
|
||||
gboolean meta_screen_cast_stream_src_pending_follow_up_frame (MetaScreenCastStreamSrc *src);
|
||||
|
@ -194,11 +194,11 @@ uninhibit_hw_cursor (MetaScreenCastVirtualStreamSrc *virtual_src)
|
||||
}
|
||||
|
||||
static void
|
||||
actors_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
actors_painted (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (user_data);
|
||||
MetaScreenCastRecordFlag flags;
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "clutter/clutter.h"
|
||||
|
||||
|
@ -132,8 +132,8 @@ meta_stage_impl_resize (ClutterStageWindow *stage_window,
|
||||
static void
|
||||
paint_damage_region (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *swap_region,
|
||||
cairo_region_t *queued_redraw_clip)
|
||||
MtkRegion *swap_region,
|
||||
MtkRegion *queued_redraw_clip)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||
@ -154,13 +154,13 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||
cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33);
|
||||
}
|
||||
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
n_rects = mtk_region_num_rectangles (swap_region);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
MtkRectangle rect;
|
||||
float x_1, x_2, y_1, y_2;
|
||||
|
||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||
rect = mtk_region_get_rectangle (swap_region, i);
|
||||
x_1 = rect.x;
|
||||
x_2 = rect.x + rect.width;
|
||||
y_1 = rect.y;
|
||||
@ -180,13 +180,13 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
|
||||
}
|
||||
|
||||
n_rects = cairo_region_num_rectangles (queued_redraw_clip);
|
||||
n_rects = mtk_region_num_rectangles (queued_redraw_clip);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
MtkRectangle rect;
|
||||
float x_1, x_2, y_1, y_2;
|
||||
|
||||
cairo_region_get_rectangle (queued_redraw_clip, i, &rect);
|
||||
rect = mtk_region_get_rectangle (queued_redraw_clip, i);
|
||||
x_1 = rect.x;
|
||||
x_2 = rect.x + rect.width;
|
||||
y_1 = rect.y;
|
||||
@ -202,7 +202,7 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||
static void
|
||||
queue_damage_region (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *stage_view,
|
||||
cairo_region_t *damage_region)
|
||||
MtkRegion *damage_region)
|
||||
{
|
||||
int *damage, n_rects, i;
|
||||
g_autofree int *freeme = NULL;
|
||||
@ -211,7 +211,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
||||
int fb_width;
|
||||
int fb_height;
|
||||
|
||||
if (cairo_region_is_empty (damage_region))
|
||||
if (mtk_region_is_empty (damage_region))
|
||||
return;
|
||||
|
||||
framebuffer = clutter_stage_view_get_onscreen (stage_view);
|
||||
@ -222,7 +222,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
||||
fb_width = cogl_framebuffer_get_width (framebuffer);
|
||||
fb_height = cogl_framebuffer_get_height (framebuffer);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (damage_region);
|
||||
n_rects = mtk_region_num_rectangles (damage_region);
|
||||
|
||||
if (n_rects < MAX_STACK_RECTS)
|
||||
damage = g_newa (int, n_rects * 4);
|
||||
@ -233,7 +233,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
||||
{
|
||||
MtkRectangle rect;
|
||||
|
||||
cairo_region_get_rectangle (damage_region, i, &rect);
|
||||
rect = mtk_region_get_rectangle (damage_region, i);
|
||||
|
||||
clutter_stage_view_transform_rect_to_onscreen (stage_view,
|
||||
&rect,
|
||||
@ -254,7 +254,7 @@ queue_damage_region (ClutterStageWindow *stage_window,
|
||||
static void
|
||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *stage_view,
|
||||
cairo_region_t *swap_region,
|
||||
MtkRegion *swap_region,
|
||||
gboolean swap_with_damage,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
@ -273,13 +273,13 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
int *damage, n_rects, i;
|
||||
CoglFrameInfo *frame_info;
|
||||
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
n_rects = mtk_region_num_rectangles (swap_region);
|
||||
damage = g_newa (int, n_rects * 4);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
MtkRectangle rect;
|
||||
|
||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||
rect = mtk_region_get_rectangle (swap_region, i);
|
||||
damage[i * 4] = rect.x;
|
||||
damage[i * 4 + 1] = rect.y;
|
||||
damage[i * 4 + 2] = rect.width;
|
||||
@ -333,20 +333,20 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
}
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
offset_scale_and_clamp_region (const cairo_region_t *region,
|
||||
int offset_x,
|
||||
int offset_y,
|
||||
float scale)
|
||||
static MtkRegion *
|
||||
offset_scale_and_clamp_region (const MtkRegion *region,
|
||||
int offset_x,
|
||||
int offset_y,
|
||||
float scale)
|
||||
{
|
||||
int n_rects, i;
|
||||
MtkRectangle *rects;
|
||||
g_autofree MtkRectangle *freeme = NULL;
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
n_rects = mtk_region_num_rectangles (region);
|
||||
|
||||
if (n_rects == 0)
|
||||
return cairo_region_create ();
|
||||
return mtk_region_create ();
|
||||
|
||||
if (n_rects < MAX_STACK_RECTS)
|
||||
rects = g_newa (MtkRectangle, n_rects);
|
||||
@ -358,7 +358,7 @@ offset_scale_and_clamp_region (const cairo_region_t *region,
|
||||
MtkRectangle *rect = &rects[i];
|
||||
graphene_rect_t tmp;
|
||||
|
||||
cairo_region_get_rectangle (region, i, rect);
|
||||
*rect = mtk_region_get_rectangle (region, i);
|
||||
|
||||
tmp = mtk_rectangle_to_graphene_rect (rect);
|
||||
graphene_rect_offset (&tmp, offset_x, offset_y);
|
||||
@ -367,23 +367,23 @@ offset_scale_and_clamp_region (const cairo_region_t *region,
|
||||
rect);
|
||||
}
|
||||
|
||||
return cairo_region_create_rectangles (rects, n_rects);
|
||||
return mtk_region_create_rectangles (rects, n_rects);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
scale_offset_and_clamp_region (const cairo_region_t *region,
|
||||
float scale,
|
||||
int offset_x,
|
||||
int offset_y)
|
||||
static MtkRegion *
|
||||
scale_offset_and_clamp_region (const MtkRegion *region,
|
||||
float scale,
|
||||
int offset_x,
|
||||
int offset_y)
|
||||
{
|
||||
int n_rects, i;
|
||||
MtkRectangle *rects;
|
||||
g_autofree MtkRectangle *freeme = NULL;
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
n_rects = mtk_region_num_rectangles (region);
|
||||
|
||||
if (n_rects == 0)
|
||||
return cairo_region_create ();
|
||||
return mtk_region_create ();
|
||||
|
||||
if (n_rects < MAX_STACK_RECTS)
|
||||
rects = g_newa (MtkRectangle, n_rects);
|
||||
@ -395,7 +395,7 @@ scale_offset_and_clamp_region (const cairo_region_t *region,
|
||||
MtkRectangle *rect = &rects[i];
|
||||
graphene_rect_t tmp;
|
||||
|
||||
cairo_region_get_rectangle (region, i, rect);
|
||||
*rect = mtk_region_get_rectangle (region, i);
|
||||
|
||||
tmp = mtk_rectangle_to_graphene_rect (rect);
|
||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
||||
@ -405,13 +405,13 @@ scale_offset_and_clamp_region (const cairo_region_t *region,
|
||||
rect);
|
||||
}
|
||||
|
||||
return cairo_region_create_rectangles (rects, n_rects);
|
||||
return mtk_region_create_rectangles (rects, n_rects);
|
||||
}
|
||||
|
||||
static void
|
||||
paint_stage (MetaStageImpl *stage_impl,
|
||||
ClutterStageView *stage_view,
|
||||
cairo_region_t *redraw_clip,
|
||||
MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
ClutterStage *stage = stage_impl->wrapper;
|
||||
@ -422,31 +422,31 @@ paint_stage (MetaStageImpl *stage_impl,
|
||||
clutter_stage_view_after_paint (stage_view, redraw_clip);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
static MtkRegion *
|
||||
transform_swap_region_to_onscreen (ClutterStageView *stage_view,
|
||||
cairo_region_t *swap_region)
|
||||
MtkRegion *swap_region)
|
||||
{
|
||||
CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (stage_view);
|
||||
int n_rects, i;
|
||||
MtkRectangle *rects;
|
||||
cairo_region_t *transformed_region;
|
||||
MtkRegion *transformed_region;
|
||||
int width, height;
|
||||
|
||||
width = cogl_framebuffer_get_width (onscreen);
|
||||
height = cogl_framebuffer_get_height (onscreen);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
n_rects = mtk_region_num_rectangles (swap_region);
|
||||
rects = g_newa (MtkRectangle, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (swap_region, i, &rects[i]);
|
||||
rects[i] = mtk_region_get_rectangle (swap_region, i);
|
||||
clutter_stage_view_transform_rect_to_onscreen (stage_view,
|
||||
&rects[i],
|
||||
width,
|
||||
height,
|
||||
&rects[i]);
|
||||
}
|
||||
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
||||
transformed_region = mtk_region_create_rectangles (rects, n_rects);
|
||||
|
||||
return transformed_region;
|
||||
}
|
||||
@ -506,10 +506,10 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
gboolean buffer_has_valid_damage_history = FALSE;
|
||||
gboolean has_buffer_age;
|
||||
gboolean swap_with_damage;
|
||||
cairo_region_t *redraw_clip;
|
||||
cairo_region_t *queued_redraw_clip = NULL;
|
||||
cairo_region_t *fb_clip_region;
|
||||
cairo_region_t *swap_region;
|
||||
g_autoptr (MtkRegion) redraw_clip = NULL;
|
||||
g_autoptr (MtkRegion) queued_redraw_clip = NULL;
|
||||
g_autoptr (MtkRegion) fb_clip_region = NULL;
|
||||
g_autoptr (MtkRegion) swap_region = NULL;
|
||||
ClutterDrawDebugFlag paint_debug_flags;
|
||||
ClutterDamageHistory *damage_history;
|
||||
float fb_scale;
|
||||
@ -577,16 +577,16 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
.width = fb_width,
|
||||
.height = fb_height,
|
||||
};
|
||||
fb_clip_region = cairo_region_create_rectangle (&fb_rect);
|
||||
fb_clip_region = mtk_region_create_rectangle (&fb_rect);
|
||||
|
||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||
redraw_clip = cairo_region_create_rectangle (&view_rect);
|
||||
g_clear_pointer (&redraw_clip, mtk_region_unref);
|
||||
redraw_clip = mtk_region_create_rectangle (&view_rect);
|
||||
|
||||
if (G_UNLIKELY (paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
|
||||
queued_redraw_clip = cairo_region_reference (redraw_clip);
|
||||
queued_redraw_clip = mtk_region_ref (redraw_clip);
|
||||
}
|
||||
|
||||
g_return_if_fail (!cairo_region_is_empty (fb_clip_region));
|
||||
g_return_if_fail (!mtk_region_is_empty (fb_clip_region));
|
||||
|
||||
/* XXX: It seems there will be a race here in that the stage
|
||||
* window may be resized before the cogl_onscreen_swap_region
|
||||
@ -598,11 +598,11 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
*/
|
||||
/* swap_region does not need damage history, set it up before that */
|
||||
if (!use_clipped_redraw)
|
||||
swap_region = cairo_region_create ();
|
||||
swap_region = mtk_region_create ();
|
||||
else if (clutter_stage_view_has_shadowfb (stage_view))
|
||||
swap_region = cairo_region_reference (fb_clip_region);
|
||||
swap_region = mtk_region_ref (fb_clip_region);
|
||||
else
|
||||
swap_region = cairo_region_copy (fb_clip_region);
|
||||
swap_region = mtk_region_copy (fb_clip_region);
|
||||
|
||||
swap_with_damage = FALSE;
|
||||
if (has_buffer_age)
|
||||
@ -615,17 +615,17 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
|
||||
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 (fb_clip_region, old_damage);
|
||||
mtk_region_union (fb_clip_region, old_damage);
|
||||
}
|
||||
|
||||
meta_topic (META_DEBUG_BACKEND,
|
||||
"Reusing back buffer(age=%d) - repairing region: num rects: %d",
|
||||
buffer_age,
|
||||
cairo_region_num_rectangles (fb_clip_region));
|
||||
mtk_region_num_rectangles (fb_clip_region));
|
||||
|
||||
swap_with_damage = TRUE;
|
||||
}
|
||||
@ -643,7 +643,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
* offset_scale_and_clamp_region. So we need to ensure redraw_clip
|
||||
* is a superset of fb_clip_region to avoid such gaps.
|
||||
*/
|
||||
cairo_region_destroy (redraw_clip);
|
||||
g_clear_pointer (&redraw_clip, mtk_region_unref);
|
||||
redraw_clip = scale_offset_and_clamp_region (fb_clip_region,
|
||||
1.0 / fb_scale,
|
||||
view_rect.x,
|
||||
@ -652,11 +652,10 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
|
||||
if (paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)
|
||||
{
|
||||
cairo_region_t *debug_redraw_clip;
|
||||
g_autoptr (MtkRegion) debug_redraw_clip = NULL;
|
||||
|
||||
debug_redraw_clip = cairo_region_create_rectangle (&view_rect);
|
||||
debug_redraw_clip = mtk_region_create_rectangle (&view_rect);
|
||||
paint_stage (stage_impl, stage_view, debug_redraw_clip, frame);
|
||||
cairo_region_destroy (debug_redraw_clip);
|
||||
}
|
||||
else if (use_clipped_redraw)
|
||||
{
|
||||
@ -675,15 +674,15 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
paint_stage (stage_impl, stage_view, redraw_clip, frame);
|
||||
}
|
||||
|
||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
||||
g_clear_pointer (&redraw_clip, mtk_region_unref);
|
||||
g_clear_pointer (&fb_clip_region, mtk_region_unref);
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (MetaStageImplRedrawViewSwapFramebuffer,
|
||||
"Paint (swap framebuffer)");
|
||||
|
||||
if (queued_redraw_clip)
|
||||
{
|
||||
cairo_region_t *swap_region_in_stage_space;
|
||||
g_autoptr (MtkRegion) swap_region_in_stage_space = NULL;
|
||||
|
||||
swap_region_in_stage_space =
|
||||
scale_offset_and_clamp_region (swap_region,
|
||||
@ -691,25 +690,22 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
view_rect.x,
|
||||
view_rect.y);
|
||||
|
||||
cairo_region_subtract (swap_region_in_stage_space, queued_redraw_clip);
|
||||
mtk_region_subtract (swap_region_in_stage_space, queued_redraw_clip);
|
||||
|
||||
paint_damage_region (stage_window, stage_view,
|
||||
swap_region_in_stage_space, queued_redraw_clip);
|
||||
|
||||
cairo_region_destroy (queued_redraw_clip);
|
||||
cairo_region_destroy (swap_region_in_stage_space);
|
||||
}
|
||||
|
||||
if (clutter_stage_view_get_onscreen (stage_view) !=
|
||||
clutter_stage_view_get_framebuffer (stage_view) &&
|
||||
cairo_region_num_rectangles (swap_region) != 0)
|
||||
mtk_region_num_rectangles (swap_region) != 0)
|
||||
{
|
||||
cairo_region_t *transformed_swap_region;
|
||||
g_autoptr (MtkRegion) transformed_swap_region = NULL;
|
||||
|
||||
transformed_swap_region =
|
||||
transform_swap_region_to_onscreen (stage_view, swap_region);
|
||||
cairo_region_destroy (swap_region);
|
||||
swap_region = transformed_swap_region;
|
||||
g_clear_pointer (&swap_region, mtk_region_unref);
|
||||
swap_region = g_steal_pointer (&transformed_swap_region);
|
||||
}
|
||||
|
||||
swap_framebuffer (stage_window,
|
||||
@ -717,8 +713,6 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl,
|
||||
swap_region,
|
||||
swap_with_damage,
|
||||
frame);
|
||||
|
||||
cairo_region_destroy (swap_region);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -36,11 +36,11 @@ typedef enum
|
||||
META_STAGE_WATCH_AFTER_PAINT,
|
||||
} MetaStageWatchPhase;
|
||||
|
||||
typedef void (* MetaStageWatchFunc) (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data);
|
||||
typedef void (* MetaStageWatchFunc) (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
gpointer user_data);
|
||||
|
||||
ClutterActor *meta_stage_new (MetaBackend *backend);
|
||||
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#include "backends/meta-stage-view.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -175,11 +175,11 @@ meta_stage_finalize (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
notify_watchers_for_mode (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
MetaStageWatchPhase watch_phase)
|
||||
notify_watchers_for_mode (MetaStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame,
|
||||
MetaStageWatchPhase watch_phase)
|
||||
{
|
||||
GPtrArray *watchers;
|
||||
int i;
|
||||
@ -215,7 +215,7 @@ meta_stage_paint (ClutterActor *actor,
|
||||
MetaStage *stage = META_STAGE (actor);
|
||||
ClutterStageView *view;
|
||||
ClutterFrame *frame;
|
||||
const cairo_region_t *redraw_clip;
|
||||
const MtkRegion *redraw_clip;
|
||||
|
||||
CLUTTER_ACTOR_CLASS (meta_stage_parent_class)->paint (actor, paint_context);
|
||||
|
||||
@ -258,10 +258,10 @@ meta_stage_paint (ClutterActor *actor,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterFrame *frame)
|
||||
meta_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
MetaStage *meta_stage = META_STAGE (stage);
|
||||
|
||||
|
@ -427,7 +427,7 @@ meta_backend_native_set_pointer_constraint (MetaBackend *backend,
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
MetaPointerConstraintImpl *constraint_impl = NULL;
|
||||
cairo_region_t *region;
|
||||
MtkRegion *region;
|
||||
|
||||
if (constraint)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ struct _MetaPointerConstraintImplNative
|
||||
{
|
||||
MetaPointerConstraintImpl parent;
|
||||
MetaPointerConstraint *constraint;
|
||||
cairo_region_t *region;
|
||||
MtkRegion *region;
|
||||
double min_edge_distance;
|
||||
};
|
||||
|
||||
@ -223,8 +223,8 @@ add_band_bottom_edges (MetaBox *boxes,
|
||||
}
|
||||
|
||||
static void
|
||||
region_to_outline (cairo_region_t *region,
|
||||
GArray *borders)
|
||||
region_to_outline (MtkRegion *region,
|
||||
GArray *borders)
|
||||
{
|
||||
MetaBox *boxes;
|
||||
int num_boxes;
|
||||
@ -249,12 +249,12 @@ region_to_outline (cairo_region_t *region,
|
||||
*
|
||||
*/
|
||||
|
||||
num_boxes = cairo_region_num_rectangles (region);
|
||||
num_boxes = mtk_region_num_rectangles (region);
|
||||
boxes = g_new (MetaBox, num_boxes);
|
||||
for (i = 0; i < num_boxes; i++)
|
||||
{
|
||||
MtkRectangle rect;
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
rect = mtk_region_get_rectangle (region, i);
|
||||
boxes[i] = (MetaBox) {
|
||||
.x1 = rect.x,
|
||||
.y1 = rect.y,
|
||||
@ -451,7 +451,7 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
|
||||
float *y_inout)
|
||||
{
|
||||
MetaPointerConstraintImplNative *constraint_impl_native;
|
||||
cairo_region_t *region;
|
||||
g_autoptr (MtkRegion) region = NULL;
|
||||
float x, y;
|
||||
g_autoptr (GArray) borders = NULL;
|
||||
MetaLine2 motion;
|
||||
@ -460,7 +460,7 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
|
||||
|
||||
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl);
|
||||
|
||||
region = cairo_region_reference (constraint_impl_native->region);
|
||||
region = mtk_region_ref (constraint_impl_native->region);
|
||||
x = *x_inout;
|
||||
y = *y_inout;
|
||||
|
||||
@ -484,7 +484,6 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
|
||||
* confined motion vectors.
|
||||
*/
|
||||
region_to_outline (region, borders);
|
||||
cairo_region_destroy (region);
|
||||
|
||||
motion = (MetaLine2) {
|
||||
.a = (MetaVector2) {
|
||||
@ -590,19 +589,19 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
|
||||
{
|
||||
MetaPointerConstraintImplNative *constraint_impl_native;
|
||||
graphene_point_t point;
|
||||
cairo_region_t *region;
|
||||
g_autoptr (MtkRegion) region = NULL;
|
||||
float x;
|
||||
float y;
|
||||
|
||||
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (constraint_impl);
|
||||
region = cairo_region_reference (constraint_impl_native->region);
|
||||
region = mtk_region_ref (constraint_impl_native->region);
|
||||
|
||||
clutter_seat_query_state (clutter_input_device_get_seat (device),
|
||||
device, NULL, &point, NULL);
|
||||
x = point.x;
|
||||
y = point.y;
|
||||
|
||||
if (!cairo_region_contains_point (region, (int) x, (int) y))
|
||||
if (!mtk_region_contains_point (region, (int) x, (int) y))
|
||||
{
|
||||
g_autoptr (GArray) borders = NULL;
|
||||
float closest_distance_2 = FLT_MAX;
|
||||
@ -632,8 +631,6 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
|
||||
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||
clutter_seat_warp_pointer (seat, x, y);
|
||||
}
|
||||
|
||||
cairo_region_destroy (region);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -642,7 +639,7 @@ meta_pointer_constraint_impl_native_finalize (GObject *object)
|
||||
MetaPointerConstraintImplNative *constraint_impl_native;
|
||||
|
||||
constraint_impl_native = META_POINTER_CONSTRAINT_IMPL_NATIVE (object);
|
||||
g_clear_pointer (&constraint_impl_native->region, cairo_region_destroy);
|
||||
g_clear_pointer (&constraint_impl_native->region, mtk_region_unref);
|
||||
|
||||
G_OBJECT_CLASS (meta_pointer_constraint_impl_native_parent_class)->finalize (object);
|
||||
}
|
||||
@ -669,7 +666,7 @@ meta_pointer_constraint_impl_native_class_init (MetaPointerConstraintImplNativeC
|
||||
|
||||
MetaPointerConstraintImpl *
|
||||
meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint,
|
||||
const cairo_region_t *region,
|
||||
const MtkRegion *region,
|
||||
double min_edge_distance)
|
||||
{
|
||||
MetaPointerConstraintImplNative *constraint_impl;
|
||||
@ -677,7 +674,7 @@ meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint,
|
||||
constraint_impl = g_object_new (META_TYPE_POINTER_CONSTRAINT_IMPL_NATIVE,
|
||||
NULL);
|
||||
constraint_impl->constraint = constraint;
|
||||
constraint_impl->region = cairo_region_copy (region);
|
||||
constraint_impl->region = mtk_region_copy (region);
|
||||
constraint_impl->min_edge_distance = min_edge_distance;
|
||||
|
||||
return META_POINTER_CONSTRAINT_IMPL (constraint_impl);
|
||||
|
@ -36,7 +36,7 @@ G_DECLARE_FINAL_TYPE (MetaPointerConstraintImplNative,
|
||||
MetaPointerConstraintImpl)
|
||||
|
||||
MetaPointerConstraintImpl * meta_pointer_constraint_impl_native_new (MetaPointerConstraint *constraint_impl,
|
||||
const cairo_region_t *region,
|
||||
const MtkRegion *region,
|
||||
double min_edge_distance);
|
||||
|
||||
G_END_DECLS
|
||||
|
Reference in New Issue
Block a user