Skip to content

Commit

Permalink
panoramiX: macro checking if drawable is root (v2)
Browse files Browse the repository at this point in the history
this code appears in quite a few places, consolidate it into
a macro in a header.

v2: align braces with macro just above it, and with
lines removed

Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Peter Hutterer <[email protected]>
  • Loading branch information
airlied committed Mar 9, 2011
1 parent 628d16a commit c48c530
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions Xext/panoramiX.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ typedef struct {

#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)

#define IS_ROOT_DRAWABLE(d) (((d)->type == XRT_WINDOW) && (d)->u.win.root)
#endif /* _PANORAMIX_H_ */
26 changes: 13 additions & 13 deletions Xext/panoramiXprocs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ int PanoramiXPolyLine(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
if (npoint > 0){
origPts = malloc(npoint * sizeof(xPoint));
Expand Down Expand Up @@ -1394,7 +1394,7 @@ int PanoramiXPolySegment(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
if(nsegs & 4) return BadLength;
Expand Down Expand Up @@ -1457,7 +1457,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
if(nrects & 4) return BadLength;
Expand Down Expand Up @@ -1519,7 +1519,7 @@ int PanoramiXPolyArc(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
if(narcs % sizeof(xArc)) return BadLength;
Expand Down Expand Up @@ -1579,7 +1579,7 @@ int PanoramiXFillPoly(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
if (count > 0){
Expand Down Expand Up @@ -1640,7 +1640,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
if(things & 4) return BadLength;
Expand Down Expand Up @@ -1701,7 +1701,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
if (narcs % sizeof(xArc)) return BadLength;
Expand Down Expand Up @@ -1761,7 +1761,7 @@ int PanoramiXPutImage(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

orig_x = stuff->dstX;
orig_y = stuff->dstY;
Expand Down Expand Up @@ -1824,7 +1824,7 @@ int PanoramiXGetImage(ClientPtr client)
format = stuff->format;
planemask = stuff->planeMask;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

if(isRoot) {
if( /* check for being onscreen */
Expand Down Expand Up @@ -1962,7 +1962,7 @@ PanoramiXPolyText8(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

orig_x = stuff->x;
orig_y = stuff->y;
Expand Down Expand Up @@ -2003,7 +2003,7 @@ PanoramiXPolyText16(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

orig_x = stuff->x;
orig_y = stuff->y;
Expand Down Expand Up @@ -2044,7 +2044,7 @@ int PanoramiXImageText8(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

orig_x = stuff->x;
orig_y = stuff->y;
Expand Down Expand Up @@ -2085,7 +2085,7 @@ int PanoramiXImageText16(ClientPtr client)
if (result != Success)
return result;

isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
isRoot = IS_ROOT_DRAWABLE(draw);

orig_x = stuff->x;
orig_y = stuff->y;
Expand Down

0 comments on commit c48c530

Please sign in to comment.