monitor-transform: Add generic function to get relative transform
It takes transforms A and B and returns the transform to get from A to B. https://gitlab.gnome.org/GNOME/mutter/merge_requests/526
This commit is contained in:
parent
1fc7935858
commit
d600cd9aee
@ -53,3 +53,30 @@ meta_monitor_transform_transform (MetaMonitorTransform transform,
|
|||||||
|
|
||||||
return new_transform;
|
return new_transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_monitor_transform_relative_transform:
|
||||||
|
* @transform: The transform to start from
|
||||||
|
* @other: The transform to go to
|
||||||
|
*
|
||||||
|
* Return value: a transform to get from @transform to @other
|
||||||
|
*/
|
||||||
|
MetaMonitorTransform
|
||||||
|
meta_monitor_transform_relative_transform (MetaMonitorTransform transform,
|
||||||
|
MetaMonitorTransform other)
|
||||||
|
{
|
||||||
|
MetaMonitorTransform relative_transform;
|
||||||
|
|
||||||
|
relative_transform = ((other % META_MONITOR_TRANSFORM_FLIPPED -
|
||||||
|
transform % META_MONITOR_TRANSFORM_FLIPPED) %
|
||||||
|
META_MONITOR_TRANSFORM_FLIPPED);
|
||||||
|
|
||||||
|
if (meta_monitor_transform_is_flipped (transform) !=
|
||||||
|
meta_monitor_transform_is_flipped (other))
|
||||||
|
{
|
||||||
|
relative_transform = (meta_monitor_transform_invert (relative_transform) +
|
||||||
|
META_MONITOR_TRANSFORM_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return relative_transform;
|
||||||
|
}
|
||||||
|
@ -58,4 +58,7 @@ META_EXPORT_TEST
|
|||||||
MetaMonitorTransform meta_monitor_transform_transform (MetaMonitorTransform transform,
|
MetaMonitorTransform meta_monitor_transform_transform (MetaMonitorTransform transform,
|
||||||
MetaMonitorTransform other);
|
MetaMonitorTransform other);
|
||||||
|
|
||||||
|
MetaMonitorTransform meta_monitor_transform_relative_transform (MetaMonitorTransform transform,
|
||||||
|
MetaMonitorTransform other);
|
||||||
|
|
||||||
#endif /* META_MONITOR_TRANSFORM_H */
|
#endif /* META_MONITOR_TRANSFORM_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user