boxes: Move Rectangle.scale_double to Mtk

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
This commit is contained in:
Bilal Elmoussaoui 2024-01-06 19:37:39 +01:00 committed by Marge Bot
parent 59457dff81
commit fcc8cfff11
5 changed files with 24 additions and 24 deletions

View File

@ -367,4 +367,17 @@ mtk_rectangle_crop_and_scale (const MtkRectangle *rect,
graphene_rect_offset (&tmp, src_rect->origin.x, src_rect->origin.y);
mtk_rectangle_from_graphene_rect (&tmp, MTK_ROUNDING_STRATEGY_GROW, dest);
}
}
void
mtk_rectangle_scale_double (const MtkRectangle *rect,
double scale,
MtkRoundingStrategy rounding_strategy,
MtkRectangle *dest)
{
graphene_rect_t tmp = GRAPHENE_RECT_INIT (rect->x, rect->y,
rect->width, rect->height);
graphene_rect_scale (&tmp, scale, scale, &tmp);
mtk_rectangle_from_graphene_rect (&tmp, rounding_strategy, dest);
}

View File

@ -130,3 +130,9 @@ void mtk_rectangle_crop_and_scale (const MtkRectangle *rect,
int dst_width,
int dst_height,
MtkRectangle *dest);
MTK_EXPORT
void mtk_rectangle_scale_double (const MtkRectangle *rect,
double scale,
MtkRoundingStrategy rounding_strategy,
MtkRectangle *dest);

View File

@ -1048,10 +1048,10 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
mtk_rectangle_intersect (&buffer_rect, clip, clip);
meta_rectangle_scale_double (clip,
1.0 / stex->buffer_scale,
MTK_ROUNDING_STRATEGY_GROW,
clip);
mtk_rectangle_scale_double (clip,
1.0 / stex->buffer_scale,
MTK_ROUNDING_STRATEGY_GROW,
clip);
if (meta_monitor_transform_is_rotated (stex->transform))
{

View File

@ -241,12 +241,6 @@ META_EXPORT_TEST
gboolean meta_rectangle_is_adjacent_to (MtkRectangle *rect,
MtkRectangle *other);
META_EXPORT_TEST
void meta_rectangle_scale_double (const MtkRectangle *rect,
double scale,
MtkRoundingStrategy rounding_strategy,
MtkRectangle *dest);
META_EXPORT_TEST
void meta_rectangle_transform (const MtkRectangle *rect,
MetaMonitorTransform transform,

View File

@ -1849,19 +1849,6 @@ meta_rectangle_is_adjacent_to (MtkRectangle *rect,
return FALSE;
}
void
meta_rectangle_scale_double (const MtkRectangle *rect,
double scale,
MtkRoundingStrategy rounding_strategy,
MtkRectangle *dest)
{
graphene_rect_t tmp = GRAPHENE_RECT_INIT (rect->x, rect->y,
rect->width, rect->height);
graphene_rect_scale (&tmp, scale, scale, &tmp);
mtk_rectangle_from_graphene_rect (&tmp, rounding_strategy, dest);
}
/**
* meta_rectangle_transform:
* @rect: the #MtkRectangle to be transformed