mirror of
https://github.com/brl/mutter.git
synced 2025-01-26 03:18:56 +00:00
region: Move Region.scale to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
This commit is contained in:
parent
4513abd584
commit
6e7d314e75
@ -360,3 +360,30 @@ mtk_region_contains_rectangle (const MtkRegion *region,
|
||||
return MTK_REGION_OVERLAP_PART;
|
||||
}
|
||||
}
|
||||
|
||||
MtkRegion *
|
||||
mtk_region_scale (MtkRegion *region,
|
||||
int scale)
|
||||
{
|
||||
int n_rects, i;
|
||||
MtkRectangle *rects;
|
||||
MtkRegion *scaled_region;
|
||||
|
||||
if (scale == 1)
|
||||
return mtk_region_copy (region);
|
||||
|
||||
n_rects = mtk_region_num_rectangles (region);
|
||||
MTK_RECTANGLE_CREATE_ARRAY_SCOPED (n_rects, rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i] = mtk_region_get_rectangle (region, i);
|
||||
rects[i].x *= scale;
|
||||
rects[i].y *= scale;
|
||||
rects[i].width *= scale;
|
||||
rects[i].height *= scale;
|
||||
}
|
||||
|
||||
scaled_region = mtk_region_create_rectangles (rects, n_rects);
|
||||
|
||||
return scaled_region;
|
||||
}
|
||||
|
@ -114,4 +114,8 @@ MTK_EXPORT
|
||||
MtkRegionOverlap mtk_region_contains_rectangle (const MtkRegion *region,
|
||||
const MtkRectangle *rect);
|
||||
|
||||
MTK_EXPORT
|
||||
MtkRegion * mtk_region_scale (MtkRegion *region,
|
||||
int scale);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MtkRegion, mtk_region_unref)
|
||||
|
@ -176,33 +176,6 @@ meta_region_iterator_next (MetaRegionIterator *iter)
|
||||
}
|
||||
}
|
||||
|
||||
MtkRegion *
|
||||
meta_region_scale (MtkRegion *region,
|
||||
int scale)
|
||||
{
|
||||
int n_rects, i;
|
||||
MtkRectangle *rects;
|
||||
MtkRegion *scaled_region;
|
||||
|
||||
if (scale == 1)
|
||||
return mtk_region_copy (region);
|
||||
|
||||
n_rects = mtk_region_num_rectangles (region);
|
||||
MTK_RECTANGLE_CREATE_ARRAY_SCOPED (n_rects, rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i] = mtk_region_get_rectangle (region, i);
|
||||
rects[i].x *= scale;
|
||||
rects[i].y *= scale;
|
||||
rects[i].width *= scale;
|
||||
rects[i].height *= scale;
|
||||
}
|
||||
|
||||
scaled_region = mtk_region_create_rectangles (rects, n_rects);
|
||||
|
||||
return scaled_region;
|
||||
}
|
||||
|
||||
static void
|
||||
add_expanded_rect (MetaRegionBuilder *builder,
|
||||
int x,
|
||||
|
@ -92,9 +92,6 @@ void meta_region_iterator_init (MetaRegionIterator *iter,
|
||||
gboolean meta_region_iterator_at_end (MetaRegionIterator *iter);
|
||||
void meta_region_iterator_next (MetaRegionIterator *iter);
|
||||
|
||||
MtkRegion * meta_region_scale (MtkRegion *region,
|
||||
int scale);
|
||||
|
||||
MtkRegion * meta_make_border_region (MtkRegion *region,
|
||||
int x_amount,
|
||||
int y_amount,
|
||||
|
@ -240,7 +240,7 @@ meta_pointer_confinement_wayland_create_constraint (MetaPointerConfinementWaylan
|
||||
{
|
||||
g_autoptr (MtkRegion) scaled_region = NULL;
|
||||
|
||||
scaled_region = meta_region_scale (region, geometry_scale);
|
||||
scaled_region = mtk_region_scale (region, geometry_scale);
|
||||
g_clear_pointer (®ion, mtk_region_unref);
|
||||
region = g_steal_pointer (&scaled_region);
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ surface_process_damage (MetaWaylandSurface *surface,
|
||||
&src_rect,
|
||||
surface_rect.width,
|
||||
surface_rect.height);
|
||||
scaled_region = meta_region_scale (viewport_region, surface_scale);
|
||||
scaled_region = mtk_region_scale (viewport_region, surface_scale);
|
||||
transformed_region = meta_region_transform (scaled_region,
|
||||
surface->buffer_transform,
|
||||
buffer_rect.width,
|
||||
|
Loading…
x
Reference in New Issue
Block a user