[PATCH v4 1/3] drm/rect: Add DRM_RECT_INIT() macro
David Gow
davidgow at google.com
Wed Jun 22 07:12:26 UTC 2022
On Tue, Jun 21, 2022 at 6:02 PM Thomas Zimmermann <tzimmermann at suse.de> wrote:
>
> Hi
>
> Am 21.06.22 um 11:38 schrieb David Gow:
> > On Tue, Jun 21, 2022 at 12:06 AM José Expósito
[ ... ]
> >> +/**
> >> + * DRM_RECT_INIT - initialize a rectangle from x/y/w/h
> >> + * @x: x coordinate
> >> + * @y: y coordinate
> >> + * @w: width
> >> + * @h: height
> >> + *
> >> + * RETURNS:
> >> + * A new rectangle of the specified size.
> >> + */
> >> +#define DRM_RECT_INIT(x, y, w, h) ((struct drm_rect){ \
> >> + .x1 = (x), \
> >> + .y1 = (y), \
> >> + .x2 = (x) + (w), \
> >> + .y2 = (y) + (h) })
> >> +
> >
> > My only slight concern here is that it might be a little bit confusing
> > that a macro called DRM_RECT_INIT() accepts x/y/w/h, whereas the
> > actual struct drm_rect is x1/y1/x2/y2. If the macro were called
> > something like DRM_RECT_INIT_FROM_XYWH() or similar.
>
> The existing drm_rect_init() function uses xywh arguments. So the
> current name is consistent with existing practice. I don't think we
> refer to x2,y2 much, if ever.
>
Ah, fair enough. I wasn't aware of the existing drm_rect_init()
function, so this makes sense as-is.
Cheers,
-- David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4003 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20220622/0155c7ff/attachment-0001.bin>
More information about the dri-devel
mailing list