diff options
-rw-r--r-- | dix/region.c | 15 | ||||
-rw-r--r-- | include/regionstr.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/dix/region.c b/dix/region.c index 737d2a861..15f3d01a5 100644 --- a/dix/region.c +++ b/dix/region.c @@ -255,6 +255,21 @@ RegionDestroy(RegionPtr pReg) free(pReg); } +RegionPtr +RegionDuplicate(RegionPtr pOld) +{ + RegionPtr pNew; + + pNew = RegionCreate(&pOld->extents, 0); + if (!pNew) + return NULL; + if (!RegionCopy(pNew, pOld)) { + RegionDestroy(pNew); + return NULL; + } + return pNew; +} + void RegionPrint(RegionPtr rgn) { diff --git a/include/regionstr.h b/include/regionstr.h index 805257b3f..4a0725d62 100644 --- a/include/regionstr.h +++ b/include/regionstr.h @@ -213,6 +213,8 @@ extern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ , extern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ ); +extern _X_EXPORT RegionPtr RegionDuplicate(RegionPtr /* pOld */); + static inline Bool RegionCopy(RegionPtr dst, RegionPtr src) { |