summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2005-06-25 12:39:58 +0000
committerZack Rusin <zack@kde.org>2005-06-25 12:39:58 +0000
commit582a9f0d2ec01f1a3c5625e2f45a4599be7a11d5 (patch)
tree5eee664e79a4cc93e83842f54f797228cdc6db19 /include
parent56201222067e793a3542bcdcd39bb257b4fad2a6 (diff)
Correctly handle empty rects on region initialization.
Diffstat (limited to 'include')
-rw-r--r--include/regionstr.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/include/regionstr.h b/include/regionstr.h
index c85116863..14995e5f1 100644
--- a/include/regionstr.h
+++ b/include/regionstr.h
@@ -29,13 +29,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -63,7 +63,7 @@ typedef struct _Region RegionRec, *RegionPtr;
#define NullRegion ((RegionPtr)0)
-/*
+/*
* clip region
*/
@@ -250,9 +250,25 @@ extern RegDataRec miBrokenData;
#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
{ \
REGION_SCREEN(_pScreen); \
- (_pReg)->extents = *(_rect); \
- (_pReg)->data = (RegDataPtr)NULL; \
-}
+ if (_rect) \
+ { \
+ (_pReg)->extents = *(_rect); \
+ (_pReg)->data = (RegDataPtr)NULL; \
+ } \
+ else \
+ { \
+ (_pReg)->extents = miEmptyBox; \
+ if (((_size) > 1) && ((_pReg)->data = \
+ (RegDataPtr)xalloc(REGION_SZOF(_size)))) \
+ { \
+ (_pReg)->data->size = (_size); \
+ (_pReg)->data->numRects = 0; \
+ } \
+ else \
+ (_pReg)->data = &miEmptyData; \
+ } \
+ }
+
#define REGION_UNINIT(_pScreen, _pReg) \
{ \