]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/rect: Add drm_rect_init()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 30 Sep 2019 13:42:12 +0000 (16:42 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Oct 2019 14:45:20 +0000 (17:45 +0300)
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>
include/drm/drm_rect.h

index fc7c14627ee277079dc656b41e20e08c599c8802..cd0106135b6ad5131c74c72c36f608686d64e277 100644 (file)
@@ -69,6 +69,23 @@ struct drm_rect {
                (r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
                (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