1
0
Fork 0

region: Make Region.transform private

It is only used once in MetaWaylandSurface

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
This commit is contained in:
Bilal Elmoussaoui 2024-01-08 20:45:21 +01:00 committed by Marge Bot
parent 9953704ceb
commit fced59b33d
3 changed files with 35 additions and 40 deletions

View file

@ -125,34 +125,3 @@ meta_region_builder_finish (MetaRegionBuilder *builder)
return result;
}
MtkRegion *
meta_region_transform (const MtkRegion *region,
MetaMonitorTransform transform,
int width,
int height)
{
int n_rects, i;
MtkRectangle *rects;
MtkRegion *transformed_region;
if (transform == META_MONITOR_TRANSFORM_NORMAL)
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);
meta_rectangle_transform (&rects[i],
transform,
width,
height,
&rects[i]);
}
transformed_region = mtk_region_create_rectangles (rects, n_rects);
return transformed_region;
}

View file

@ -51,8 +51,3 @@ void meta_region_builder_add_rectangle (MetaRegionBuilder *builder,
int width,
int height);
MtkRegion * meta_region_builder_finish (MetaRegionBuilder *builder);
MtkRegion * meta_region_transform (const MtkRegion *region,
MetaMonitorTransform transform,
int width,
int height);

View file

@ -261,6 +261,37 @@ meta_wayland_surface_assign_role (MetaWaylandSurface *surface,
}
}
static MtkRegion *
region_transform (const MtkRegion *region,
MetaMonitorTransform transform,
int width,
int height)
{
MtkRegion *transformed_region;
MtkRectangle *rects;
int n_rects, i;
if (transform == META_MONITOR_TRANSFORM_NORMAL)
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);
meta_rectangle_transform (&rects[i],
transform,
width,
height,
&rects[i]);
}
transformed_region = mtk_region_create_rectangles (rects, n_rects);
return transformed_region;
}
static void
surface_process_damage (MetaWaylandSurface *surface,
MtkRegion *surface_region,
@ -336,10 +367,10 @@ surface_process_damage (MetaWaylandSurface *surface,
surface_rect.width,
surface_rect.height);
scaled_region = mtk_region_scale (viewport_region, surface_scale);
transformed_region = meta_region_transform (scaled_region,
surface->buffer_transform,
buffer_rect.width,
buffer_rect.height);
transformed_region = region_transform (scaled_region,
surface->buffer_transform,
buffer_rect.width,
buffer_rect.height);
/* Now add the scaled, cropped and transformed damage region to the
* buffer damage. Buffer damage is already in the correct coordinate