Messages in this thread | | | From | David Gow <> | Date | Wed, 22 Jun 2022 15:12:26 +0800 | Subject | Re: [PATCH v4 1/3] drm/rect: Add DRM_RECT_INIT() macro |
| |
On Tue, Jun 21, 2022 at 6:02 PM Thomas Zimmermann <tzimmermann@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 [unhandled content-type:application/pkcs7-signature] | |