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

@ -368,3 +368,16 @@ mtk_rectangle_crop_and_scale (const MtkRectangle *rect,
mtk_rectangle_from_graphene_rect (&tmp, MTK_ROUNDING_STRATEGY_GROW, dest); 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_width,
int dst_height, int dst_height,
MtkRectangle *dest); MtkRectangle *dest);
MTK_EXPORT
void mtk_rectangle_scale_double (const MtkRectangle *rect,
double scale,
MtkRoundingStrategy rounding_strategy,
MtkRectangle *dest);

View File

@ -1048,7 +1048,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
mtk_rectangle_intersect (&buffer_rect, clip, clip); mtk_rectangle_intersect (&buffer_rect, clip, clip);
meta_rectangle_scale_double (clip, mtk_rectangle_scale_double (clip,
1.0 / stex->buffer_scale, 1.0 / stex->buffer_scale,
MTK_ROUNDING_STRATEGY_GROW, MTK_ROUNDING_STRATEGY_GROW,
clip); clip);

View File

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

View File

@ -1849,19 +1849,6 @@ meta_rectangle_is_adjacent_to (MtkRectangle *rect,
return FALSE; 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: * meta_rectangle_transform:
* @rect: the #MtkRectangle to be transformed * @rect: the #MtkRectangle to be transformed