diff --git a/src/libkwineffects/effects.h b/src/libkwineffects/effects.h index 65931055d4..d9e93551ba 100644 --- a/src/libkwineffects/effects.h +++ b/src/libkwineffects/effects.h @@ -102,33 +102,6 @@ enum DataRole { WindowForceBackgroundContrastRole, ///< For fullscreen effects to enforce the background contrast, }; -/** - * Scale a rect by a scalar. - */ -KWIN_EXPORT inline QRectF scaledRect(const QRectF &rect, qreal scale) -{ - return QRectF{rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale}; -} - -/** - * Round a vector to nearest integer. - */ -KWIN_EXPORT inline QVector2D roundVector(const QVector2D &input) -{ - return QVector2D(std::round(input.x()), std::round(input.y())); -} - -/** - * Convert a QPointF to a QPoint by flooring instead of rounding. - * - * By default, QPointF::toPoint() rounds which can cause problems in certain - * cases. - */ -KWIN_EXPORT inline QPoint flooredPoint(const QPointF &point) -{ - return QPoint(std::floor(point.x()), std::floor(point.y())); -} - /** * @short Manager class that handles all the effects. * diff --git a/src/libkwineffects/globals.h b/src/libkwineffects/globals.h index 4cd32f0dae..40869e2e81 100644 --- a/src/libkwineffects/globals.h +++ b/src/libkwineffects/globals.h @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -237,6 +238,33 @@ inline KWIN_EXPORT QRect infiniteRegion() return QRect(INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX); } +/** + * Scale a rect by a scalar. + */ +KWIN_EXPORT inline QRectF scaledRect(const QRectF &rect, qreal scale) +{ + return QRectF{rect.x() * scale, rect.y() * scale, rect.width() * scale, rect.height() * scale}; +} + +/** + * Round a vector to nearest integer. + */ +KWIN_EXPORT inline QVector2D roundVector(const QVector2D &input) +{ + return QVector2D(std::round(input.x()), std::round(input.y())); +} + +/** + * Convert a QPointF to a QPoint by flooring instead of rounding. + * + * By default, QPointF::toPoint() rounds which can cause problems in certain + * cases. + */ +KWIN_EXPORT inline QPoint flooredPoint(const QPointF &point) +{ + return QPoint(std::floor(point.x()), std::floor(point.y())); +} + /** * @returns if @a point is contained in @a rect, including the left and top borders * but excluding the right and bottom borders