[1/4] drm/rect: Add drm_rect_translate_to()
diff mbox series

Message ID 20190930134214.24702-1-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/4] drm/rect: Add drm_rect_translate_to()
Related show

Commit Message

Ville Syrjälä Sept. 30, 2019, 1:42 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a helper to translate a rectangle to an absolute position.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 include/drm/drm_rect.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Jani Nikula Oct. 1, 2019, 9:26 a.m. UTC | #1
On Mon, 30 Sep 2019, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Add a helper to translate a rectangle to an absolute position.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

The series is

Reviewed-by: Jani Nikula <jani.nikula@intel.com>



> ---
>  include/drm/drm_rect.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> 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
> @@ -106,6 +106,20 @@ static inline void drm_rect_translate(struct drm_rect *r, int dx, int 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
>   * @r: rectangle to be downscaled
Ville Syrjälä Oct. 1, 2019, 2:56 p.m. UTC | #2
On Tue, Oct 01, 2019 at 12:26:52PM +0300, Jani Nikula wrote:
> On Mon, 30 Sep 2019, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Add a helper to translate a rectangle to an absolute position.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The series is
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>

Thanks. 1-2 pushed to drm-misc-next.

> 
> 
> > ---
> >  include/drm/drm_rect.h | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > 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
> > @@ -106,6 +106,20 @@ static inline void drm_rect_translate(struct drm_rect *r, int dx, int 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
> >   * @r: rectangle to be downscaled
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

Patch
diff mbox series

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
@@ -106,6 +106,20 @@  static inline void drm_rect_translate(struct drm_rect *r, int dx, int 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
  * @r: rectangle to be downscaled