compositor: Move region_to_cairo_path helper where it is used

The helper is X11 specific and only used once in that file. Moving
it there would help us in the future to build without cairo if x11 is disabled

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
This commit is contained in:
Bilal Elmoussaoui 2023-10-27 12:11:49 +02:00 committed by Marge Bot
parent 9f58fb121f
commit c683d971a1
3 changed files with 18 additions and 21 deletions

View File

@ -771,6 +771,22 @@ get_client_area_rect (MetaWindowActorX11 *actor_x11,
get_client_area_rect_from_texture (actor_x11, stex, client_area);
}
static void
region_to_cairo_path (MtkRegion *region,
cairo_t *cr)
{
MtkRectangle rect;
int n_rects, i;
n_rects = mtk_region_num_rectangles (region);
for (i = 0; i < n_rects; i++)
{
rect = mtk_region_get_rectangle (region, i);
cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
}
}
static void
build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
MtkRegion *shape_region)
@ -810,7 +826,7 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
stride);
cr = cairo_create (image);
meta_region_to_cairo_path (shape_region, cr);
region_to_cairo_path (shape_region, cr);
cairo_fill (cr);
if (window->frame)
@ -842,7 +858,7 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11,
frame_paint_region = mtk_region_create_rectangle (&rect);
mtk_region_subtract_rectangle (frame_paint_region, &client_area);
meta_region_to_cairo_path (frame_paint_region, cr);
region_to_cairo_path (frame_paint_region, cr);
cairo_clip (cr);
meta_frame_get_mask (window->frame, &frame_rect, cr);

View File

@ -428,22 +428,6 @@ meta_region_crop_and_scale (MtkRegion *region,
return viewport_region;
}
void
meta_region_to_cairo_path (MtkRegion *region,
cairo_t *cr)
{
MtkRectangle rect;
int n_rects, i;
n_rects = mtk_region_num_rectangles (region);
for (i = 0; i < n_rects; i++)
{
rect = mtk_region_get_rectangle (region, i);
cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
}
}
MtkRegion *
meta_region_apply_matrix_transform_expand (const MtkRegion *region,
graphene_matrix_t *transform)

View File

@ -20,7 +20,6 @@
#pragma once
#include <cairo.h>
#include <glib.h>
#include "backends/meta-backend-types.h"
@ -111,8 +110,6 @@ MtkRegion * meta_region_crop_and_scale (MtkRegion *region,
int dst_width,
int dst_height);
void meta_region_to_cairo_path (MtkRegion *region,
cairo_t *cr);
MtkRegion *
meta_region_apply_matrix_transform_expand (const MtkRegion *region,