summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-09-30 16:42:11 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-10-01 17:45:20 +0300
commit763ba2eca0f1a0b04529b4d118592c4dd387d53a (patch)
treec1d22b61f05aca1d661584eee755995402390280 /include/drm
parentf59769c52cd7d158df53487ec2936f5592073340 (diff)
drm/rect: Add drm_rect_translate_to()
Add a helper to translate a rectangle to an absolute position. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190930134214.24702-1-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_rect.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 6195820aa5c5..fc7c14627ee2 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -107,6 +107,20 @@ static inline void drm_rect_translate(struct drm_rect *r, int dx, int 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
* @r: rectangle to be downscaled
* @horz: horizontal downscale factor