[PATCH 1/2] Add RegionInitBoxes(), and fix some buggy callers of RegionInit().
Søren Sandmann
sandmann at cs.au.dk
Wed Mar 30 08:34:09 PDT 2011
From: Søren Sandmann Pedersen <ssp at redhat.com>
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.
Signed-off-by: Soren Sandmann <ssp at redhat.com>
---
exa/exa_unaccel.c | 4 ++--
glx/glxdri.c | 2 +-
include/regionstr.h | 5 +++++
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index bd533c4..fe0680d 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -131,7 +131,7 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
PixmapPtr pPixmap = exaGetDrawablePixmap(pSrc);
exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
- RegionInit(®, pbox, nbox);
+ RegionInitBoxes(®, pbox, nbox);
RegionTranslate(®, xoff + dx, yoff + dy);
pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, ®);
RegionUninit(®);
@@ -144,7 +144,7 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
- RegionInit(®, pbox, nbox);
+ RegionInitBoxes(®, pbox, nbox);
RegionTranslate(®, xoff, yoff);
pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST, ®);
RegionUninit(®);
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 3a57337..a0fadc4 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -831,7 +831,7 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
__glXenterServer(GL_FALSE);
- RegionInit(®ion, (BoxPtr) rects, num_rects);
+ RegionInitBoxes(®ion, (BoxPtr) rects, num_rects);
RegionTranslate(®ion, pDraw->x, pDraw->y);
DamageDamageRegion(pDraw, ®ion);
RegionUninit(®ion);
diff --git a/include/regionstr.h b/include/regionstr.h
index 3759fe1..2448c25 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 void RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
+{
+ pixman_region_init_rects (pReg, boxes, nBoxes);
+}
+
static inline void RegionUninit(RegionPtr _pReg)
{
if ((_pReg)->data && (_pReg)->data->size) {
--
1.7.4
More information about the xorg-devel
mailing list