mtk: Move Rectangle.intersect from Meta

Also replaces it usage everywhere & remove the Clutter helper. Note the
tests were not moved yet to mtk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
This commit is contained in:
Bilal Elmoussaoui
2023-07-19 17:40:37 +02:00
parent 6f66dd9944
commit 565acaed9c
20 changed files with 107 additions and 142 deletions

View File

@ -214,10 +214,6 @@ void _clutter_util_rectangle_offset (const MtkRectangle *src,
int y,
MtkRectangle *dest);
gboolean _clutter_util_rectangle_intersection (const MtkRectangle *src1,
const MtkRectangle *src2,
MtkRectangle *dest);
CLUTTER_EXPORT
PangoDirection _clutter_pango_unichar_direction (gunichar ch);

View File

@ -602,7 +602,7 @@ find_damaged_tiles (ClutterStageView *view,
CAIRO_REGION_OVERLAP_OUT)
continue;
_clutter_util_rectangle_intersection (&tile, &fb_rect, &tile);
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);

View File

@ -263,8 +263,8 @@ clutter_stage_add_redraw_clip (ClutterStage *stage,
MtkRectangle intersection;
clutter_stage_view_get_layout (view, &view_layout);
if (_clutter_util_rectangle_intersection (&view_layout, clip,
&intersection))
if (mtk_rectangle_intersect (&view_layout, clip,
&intersection))
clutter_stage_view_add_redraw_clip (view, &intersection);
}
}

View File

@ -163,39 +163,6 @@ _clutter_util_rectangle_offset (const MtkRectangle *src,
dest->y += y;
}
gboolean
_clutter_util_rectangle_intersection (const MtkRectangle *src1,
const MtkRectangle *src2,
MtkRectangle *dest)
{
int x1, y1, x2, y2;
x1 = MAX (src1->x, src2->x);
y1 = MAX (src1->y, src2->y);
x2 = MIN (src1->x + (int) src1->width, src2->x + (int) src2->width);
y2 = MIN (src1->y + (int) src1->height, src2->y + (int) src2->height);
if (x1 >= x2 || y1 >= y2)
{
dest->x = 0;
dest->y = 0;
dest->width = 0;
dest->height = 0;
return FALSE;
}
else
{
dest->x = x1;
dest->y = y1;
dest->width = x2 - x1;
dest->height = y2 - y1;
return TRUE;
}
}
typedef struct
{
GType value_type;