Replace ClutterRect by graphene_rect_t
https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
This commit is contained in:
@ -252,10 +252,10 @@ void meta_rectangle_scale_double (const MetaRectangle *rect,
|
||||
MetaRoundingStrategy rounding_strategy,
|
||||
MetaRectangle *dest);
|
||||
|
||||
static inline ClutterRect
|
||||
meta_rectangle_to_clutter_rect (MetaRectangle *rect)
|
||||
static inline graphene_rect_t
|
||||
meta_rectangle_to_graphene_rect (MetaRectangle *rect)
|
||||
{
|
||||
return (ClutterRect) {
|
||||
return (graphene_rect_t) {
|
||||
.origin = {
|
||||
.x = rect->x,
|
||||
.y = rect->y
|
||||
@ -274,12 +274,12 @@ void meta_rectangle_transform (const MetaRectangle *rect,
|
||||
int height,
|
||||
MetaRectangle *dest);
|
||||
|
||||
void meta_rectangle_from_clutter_rect (ClutterRect *rect,
|
||||
MetaRoundingStrategy rounding_strategy,
|
||||
MetaRectangle *dest);
|
||||
void meta_rectangle_from_graphene_rect (const graphene_rect_t *rect,
|
||||
MetaRoundingStrategy rounding_strategy,
|
||||
MetaRectangle *dest);
|
||||
|
||||
void meta_rectangle_crop_and_scale (const MetaRectangle *rect,
|
||||
ClutterRect *src_rect,
|
||||
graphene_rect_t *src_rect,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
MetaRectangle *dest);
|
||||
|
@ -2042,11 +2042,11 @@ meta_rectangle_scale_double (const MetaRectangle *rect,
|
||||
MetaRoundingStrategy rounding_strategy,
|
||||
MetaRectangle *dest)
|
||||
{
|
||||
ClutterRect tmp = CLUTTER_RECT_INIT (rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
graphene_rect_t tmp = GRAPHENE_RECT_INIT (rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
|
||||
clutter_rect_scale (&tmp, scale, scale);
|
||||
meta_rectangle_from_clutter_rect (&tmp, rounding_strategy, dest);
|
||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
||||
meta_rectangle_from_graphene_rect (&tmp, rounding_strategy, dest);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2121,9 +2121,9 @@ meta_rectangle_transform (const MetaRectangle *rect,
|
||||
}
|
||||
|
||||
void
|
||||
meta_rectangle_from_clutter_rect (ClutterRect *rect,
|
||||
MetaRoundingStrategy rounding_strategy,
|
||||
MetaRectangle *dest)
|
||||
meta_rectangle_from_graphene_rect (const graphene_rect_t *rect,
|
||||
MetaRoundingStrategy rounding_strategy,
|
||||
MetaRectangle *dest)
|
||||
{
|
||||
switch (rounding_strategy)
|
||||
{
|
||||
@ -2139,8 +2139,9 @@ meta_rectangle_from_clutter_rect (ClutterRect *rect,
|
||||
break;
|
||||
case META_ROUNDING_STRATEGY_GROW:
|
||||
{
|
||||
ClutterRect clamped = *rect;
|
||||
clutter_rect_clamp_to_pixel (&clamped);
|
||||
graphene_rect_t clamped = *rect;
|
||||
|
||||
graphene_rect_round_extents (&clamped, &clamped);
|
||||
|
||||
*dest = (MetaRectangle) {
|
||||
.x = clamped.origin.x,
|
||||
@ -2155,18 +2156,19 @@ meta_rectangle_from_clutter_rect (ClutterRect *rect,
|
||||
|
||||
void
|
||||
meta_rectangle_crop_and_scale (const MetaRectangle *rect,
|
||||
ClutterRect *src_rect,
|
||||
graphene_rect_t *src_rect,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
MetaRectangle *dest)
|
||||
{
|
||||
ClutterRect tmp = CLUTTER_RECT_INIT (rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
graphene_rect_t tmp = GRAPHENE_RECT_INIT (rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
|
||||
clutter_rect_scale (&tmp,
|
||||
src_rect->size.width / dst_width,
|
||||
src_rect->size.height / dst_height);
|
||||
clutter_rect_offset (&tmp, src_rect->origin.x, src_rect->origin.y);
|
||||
graphene_rect_scale (&tmp,
|
||||
src_rect->size.width / dst_width,
|
||||
src_rect->size.height / dst_height,
|
||||
&tmp);
|
||||
graphene_rect_offset (&tmp, src_rect->origin.x, src_rect->origin.y);
|
||||
|
||||
meta_rectangle_from_clutter_rect (&tmp, META_ROUNDING_STRATEGY_GROW, dest);
|
||||
meta_rectangle_from_graphene_rect (&tmp, META_ROUNDING_STRATEGY_GROW, dest);
|
||||
}
|
||||
|
@ -1540,7 +1540,7 @@ find_highest_logical_monitor_scale (MetaBackend *backend,
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaCursorRenderer *cursor_renderer =
|
||||
meta_backend_get_cursor_renderer (backend);
|
||||
ClutterRect cursor_rect;
|
||||
graphene_rect_t cursor_rect;
|
||||
GList *logical_monitors;
|
||||
GList *l;
|
||||
float highest_scale = 0.0;
|
||||
@ -1553,12 +1553,12 @@ find_highest_logical_monitor_scale (MetaBackend *backend,
|
||||
for (l = logical_monitors; l; l = l->next)
|
||||
{
|
||||
MetaLogicalMonitor *logical_monitor = l->data;
|
||||
ClutterRect logical_monitor_rect =
|
||||
meta_rectangle_to_clutter_rect (&logical_monitor->rect);
|
||||
graphene_rect_t logical_monitor_rect =
|
||||
meta_rectangle_to_graphene_rect (&logical_monitor->rect);
|
||||
|
||||
if (!clutter_rect_intersection (&cursor_rect,
|
||||
&logical_monitor_rect,
|
||||
NULL))
|
||||
if (!graphene_rect_intersection (&cursor_rect,
|
||||
&logical_monitor_rect,
|
||||
NULL))
|
||||
continue;
|
||||
|
||||
highest_scale = MAX (highest_scale, logical_monitor->scale);
|
||||
|
Reference in New Issue
Block a user