Commit 763ba2ec authored by Ville Syrjälä's avatar Ville Syrjälä

drm/rect: Add drm_rect_translate_to()

Add a helper to translate a rectangle to an absolute position.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190930134214.24702-1-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent f59769c5
...@@ -106,6 +106,20 @@ static inline void drm_rect_translate(struct drm_rect *r, int dx, int dy) ...@@ -106,6 +106,20 @@ static inline void drm_rect_translate(struct drm_rect *r, int dx, int dy)
r->y2 += dy; r->y2 += dy;
} }
/**
* drm_rect_translate_to - translate the rectangle to an absolute position
* @r: rectangle to be tranlated
* @x: horizontal position
* @y: vertical position
*
* Move rectangle @r to @x in the horizontal direction,
* and to @y in the vertical direction.
*/
static inline void drm_rect_translate_to(struct drm_rect *r, int x, int y)
{
drm_rect_translate(r, x - r->x1, y - r->y1);
}
/** /**
* drm_rect_downscale - downscale a rectangle * drm_rect_downscale - downscale a rectangle
* @r: rectangle to be downscaled * @r: rectangle to be downscaled
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment