summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-03-29 13:06:36 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-04-22 21:39:31 -0400
commit61a92a78cd49969f74a046fa26c3199e06365814 (patch)
tree3a720768b20e76fdd935a11a76711d9f3984290c /include
parentc7bce22b58530239e583d91ae56312bad1630da4 (diff)
Add RegionInitBoxes(), and fix some buggy callers of RegionInit().
The interface to RegionInit(): RegionInit (RegionPtr pReg, BoxPtr rect, int size); is very confusing because it doesn't take a list of boxes, it takes *one* box, but if that box is NULL, it initializes an empty region with 'size' rectangles preallocated. Most callers of this function were correctly passing either NULL or just one box, but there were three confused cases, where the code seems to expect a region to be created from a list of boxes. This patch adds a new function RegionInitBoxes() and fixes those instances to call that instead. And yes, the pixman function to initialize a region from a list of boxes is called init_rects() because pixman is also awesome. V2: Make RegionInitBoxes() return a Bool indicating whether the call succeeded, and fix the callers to check this return value. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Søren Sandmann <ssp@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/regionstr.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/regionstr.h b/include/regionstr.h
index 3759fe17b..3dfef5c83 100644
--- a/include/regionstr.h
+++ b/include/regionstr.h
@@ -132,6 +132,11 @@ static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
}
}
+static inline Bool RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
+{
+ return pixman_region_init_rects (pReg, boxes, nBoxes);
+}
+
static inline void RegionUninit(RegionPtr _pReg)
{
if ((_pReg)->data && (_pReg)->data->size) {