aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/drm/drm_rect.h
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-09-30 16:42:12 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-10-01 17:45:20 +0300
commite22b86e97317cff590e3b0775fc2c842c1bff098 (patch)
tree49aedc712c1b9e4526dbd18624c58bdf033af170 /include/drm/drm_rect.h
parentdrm/rect: Add drm_rect_translate_to() (diff)
downloadwireguard-linux-e22b86e97317cff590e3b0775fc2c842c1bff098.tar.xz
wireguard-linux-e22b86e97317cff590e3b0775fc2c842c1bff098.zip
drm/rect: Add drm_rect_init()
Add a helper to initialize a rectangle from x/y/w/h information. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190930134214.24702-2-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'include/drm/drm_rect.h')
-rw-r--r--include/drm/drm_rect.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index fc7c14627ee2..cd0106135b6a 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -70,6 +70,23 @@ struct drm_rect {
(r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
/**
+ * drm_rect_init - initialize the rectangle from x/y/w/h
+ * @r: rectangle
+ * @x: x coordinate
+ * @y: y coordinate
+ * @width: width
+ * @height: height
+ */
+static inline void drm_rect_init(struct drm_rect *r, int x, int y,
+ int width, int height)
+{
+ r->x1 = x;
+ r->y1 = y;
+ r->x2 = x + width;
+ r->y2 = y + height;
+}
+
+/**
* drm_rect_adjust_size - adjust the size of the rectangle
* @r: rectangle to be adjusted
* @dw: horizontal adjustment