Lines Matching +full:in +full:- +full:band
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in
36 used in advertising or publicity pertaining to distribution of the
40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
56 in the Software without restriction, including without limitation the rights
60 The above copyright notice and this permission notice shall be included in
65 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
68 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
69 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
71 Except as contained in this notice, the name of Digital Equipment Corporation
72 shall not be used in advertising or otherwise to promote the sale, use or other
73 dealings in this Software without prior written authorization from Digital
79 #include <dix-config.h>
105 * The functions in this file implement the Region abstraction used extensively
107 * (non-overlapping) rectangles, plus an "extent" rectangle which is the
108 * smallest single rectangle that contains all the non-overlapping rectangles.
110 * A Region is implemented as a "y-x-banded" array of rectangles. This array
114 * Furthermore, the rectangles are grouped into "bands". Each rectangle in a
115 * band has the same top y coordinate (y1), and each has the same bottom y
116 * coordinate (y2). Thus all rectangles in a band differ only in their left
117 * and right side (x1 and x2). Bands are implicit in the array of rectangles:
118 * there is no separate list of band start pointers.
120 * The y-x band representation does not minimize rectangles. In particular,
121 * if a rectangle vertically crosses a band (the rectangle has scanlines in
122 * the y1 to y2 area spanned by the band), then the rectangle may be broken
125 * ----------- -----------
126 * | | | | band 0
127 * | | -------- ----------- --------
128 * | | | | in y-x banded | | | | band 1
130 * ----------- | | ----------- --------
131 * | | | | band 2
132 * -------- --------
135 * horizontal area as possible: no two rectangles within a band are allowed
141 * rectangles in the same places (of the same width, of course).
145 * and added RegionValidate in order to support several speed improvements
153 (!( ((r1)->x2 <= (r2)->x1) || \
154 ((r1)->x1 >= (r2)->x2) || \
155 ((r1)->y2 <= (r2)->y1) || \
156 ((r1)->y1 >= (r2)->y2) ) )
158 /* true iff (x,y) is in Box */
160 ( ((r)->x2 > x) && \
161 ((r)->x1 <= x) && \
162 ((r)->y2 > y) && \
163 ((r)->y1 <= y) )
167 ( ((r1)->x1 <= (r2)->x1) && \
168 ((r1)->x2 >= (r2)->x2) && \
169 ((r1)->y1 <= (r2)->y1) && \
170 ((r1)->y2 >= (r2)->y2) )
172 #define xfreeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data)
175 if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
179 if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
184 pNextRect->x1 = nx1; \
185 pNextRect->y1 = ny1; \
186 pNextRect->x2 = nx2; \
187 pNextRect->y2 = ny2; \
193 if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
200 pReg->data->numRects++; \
201 assert(pReg->data->numRects<=pReg->data->size); \
205 if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
209 (NewSize > 0) ? realloc((reg)->data, NewSize) : NULL ; \
212 NewData->size = (numRects); \
213 (reg)->data = NewData; \
263 pNew = RegionCreate(&pOld->extents, 0); in RegionDuplicate()
285 rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2); in RegionPrint()
298 if ((reg->extents.x1 > reg->extents.x2) || in RegionIsValid()
299 (reg->extents.y1 > reg->extents.y2)) in RegionIsValid()
303 return ((reg->extents.x1 == reg->extents.x2) && in RegionIsValid()
304 (reg->extents.y1 == reg->extents.y2) && in RegionIsValid()
305 (reg->data->size || (reg->data == &RegionEmptyData))); in RegionIsValid()
307 return !reg->data; in RegionIsValid()
314 box.y2 = pboxP[numRects - 1].y2; in RegionIsValid()
316 for (i = numRects; --i > 0; pboxP++, pboxN++) { in RegionIsValid()
317 if ((pboxN->x1 >= pboxN->x2) || (pboxN->y1 >= pboxN->y2)) in RegionIsValid()
319 if (pboxN->x1 < box.x1) in RegionIsValid()
320 box.x1 = pboxN->x1; in RegionIsValid()
321 if (pboxN->x2 > box.x2) in RegionIsValid()
322 box.x2 = pboxN->x2; in RegionIsValid()
323 if ((pboxN->y1 < pboxP->y1) || in RegionIsValid()
324 ((pboxN->y1 == pboxP->y1) && in RegionIsValid()
325 ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2)))) in RegionIsValid()
328 return ((box.x1 == reg->extents.x1) && in RegionIsValid()
329 (box.x2 == reg->extents.x2) && in RegionIsValid()
330 (box.y1 == reg->extents.y1) && (box.y2 == reg->extents.y2)); in RegionIsValid()
339 pReg->extents = RegionEmptyBox; in RegionBreak()
340 pReg->data = &RegionBrokenData; in RegionBreak()
350 if (!pRgn->data) { in RegionRectAlloc()
353 pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; in RegionRectAlloc()
354 if (!pRgn->data) in RegionRectAlloc()
356 pRgn->data->numRects = 1; in RegionRectAlloc()
357 *RegionBoxptr(pRgn) = pRgn->extents; in RegionRectAlloc()
359 else if (!pRgn->data->size) { in RegionRectAlloc()
361 pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; in RegionRectAlloc()
362 if (!pRgn->data) in RegionRectAlloc()
364 pRgn->data->numRects = 0; in RegionRectAlloc()
368 n = pRgn->data->numRects; in RegionRectAlloc()
372 n += pRgn->data->numRects; in RegionRectAlloc()
374 data = (rgnSize > 0) ? realloc(pRgn->data, rgnSize) : NULL; in RegionRectAlloc()
377 pRgn->data = data; in RegionRectAlloc()
379 pRgn->data->size = n; in RegionRectAlloc()
387 /*-
388 *-----------------------------------------------------------------------
389 * RegionCoalesce --
390 * Attempt to merge the boxes in the current band with those in the
391 * previous one. We are guaranteed that the current band extends to
395 * The new index for the previous band.
399 * - rectangles in the previous band will have their y2 fields
401 * - pReg->data->numRects will be decreased.
403 *-----------------------------------------------------------------------
407 int prevStart, /* Index of start of previous band */ in RegionCoalesce()
409 { /* Index of start of current band */ in RegionCoalesce()
410 BoxPtr pPrevBox; /* Current box in previous band */ in RegionCoalesce()
411 BoxPtr pCurBox; /* Current box in current band */ in RegionCoalesce()
412 int numRects; /* Number rectangles in both bands */ in RegionCoalesce()
413 int y2; /* Bottom of current band */ in RegionCoalesce()
416 * Figure out how many rectangles are in the band. in RegionCoalesce()
418 numRects = curStart - prevStart; in RegionCoalesce()
419 assert(numRects == pReg->data->numRects - curStart); in RegionCoalesce()
430 if (pPrevBox->y2 != pCurBox->y1) in RegionCoalesce()
434 * Make sure the bands have boxes in the same places. This in RegionCoalesce()
435 * assumes that boxes have been added in such a way that they in RegionCoalesce()
436 * cover the most area possible. I.e. two boxes in a band must in RegionCoalesce()
439 y2 = pCurBox->y2; in RegionCoalesce()
442 if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) { in RegionCoalesce()
447 numRects--; in RegionCoalesce()
452 * in the previous band to the bottom y of the current band. in RegionCoalesce()
454 numRects = curStart - prevStart; in RegionCoalesce()
455 pReg->data->numRects -= numRects; in RegionCoalesce()
457 pPrevBox--; in RegionCoalesce()
458 pPrevBox->y2 = y2; in RegionCoalesce()
459 numRects--; in RegionCoalesce()
467 if (curBand - prevBand == newReg->data->numRects - curBand) { \
473 /*-
474 *-----------------------------------------------------------------------
475 * RegionAppendNonO --
476 * Handle a non-overlapping band for the union and subtract operations.
477 * Just adds the (top/bottom-clipped) rectangles into the region.
484 * pReg->data->numRects is incremented and the rectangles overwritten
487 *-----------------------------------------------------------------------
496 newRects = rEnd - r; in RegionAppendNonO()
504 pReg->data->numRects += newRects; in RegionAppendNonO()
506 assert(r->x1 < r->x2); in RegionAppendNonO()
507 ADDRECT(pNextRect, r->x1, y1, r->x2, y2); in RegionAppendNonO()
516 ry1 = r->y1; \
518 while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \
526 if ((newRects = rEnd - r)) { \
530 newReg->data->numRects += newRects; \
534 /*-
535 *-----------------------------------------------------------------------
536 * RegionOp --
553 * each the band and the band's upper and lower extents. For the
554 * second, the overlapFunc is called to process the entire band. It
555 * is responsible for clipping the rectangles in the band, though
557 * At the end of each band, the new region is coalesced, if possible,
558 * to reduce the number of rectangles in the region.
560 *-----------------------------------------------------------------------
572 RegionPtr reg1, /* First region in operation */ in RegionOp()
573 RegionPtr reg2, /* 2d region in operation */ in RegionOp()
574 OverlapProcPtr overlapFunc, /* Function to call for over- in RegionOp()
576 Bool appendNon1, /* Append non-overlapping bands */ in RegionOp()
577 /* in region 1 ? */ in RegionOp()
578 Bool appendNon2, /* Append non-overlapping bands */ in RegionOp()
579 /* in region 2 ? */ in RegionOp()
590 * previous band in newReg */ in RegionOp()
592 * band in newReg */ in RegionOp()
593 BoxPtr r1BandEnd; /* End of current band in r1 */ in RegionOp()
594 BoxPtr r2BandEnd; /* End of current band in r2 */ in RegionOp()
595 short top; /* Top of non-overlapping band */ in RegionOp()
596 short bot; /* Bottom of non-overlapping band */ in RegionOp()
597 int r1y1; /* Temps for r1->y1 and r2->y1 */ in RegionOp()
611 * of the destination region until the end in case it's one of in RegionOp()
628 oldData = newReg->data; in RegionOp()
629 newReg->data = &RegionEmptyData; in RegionOp()
635 if (!newReg->data) in RegionOp()
636 newReg->data = &RegionEmptyData; in RegionOp()
637 else if (newReg->data->size) in RegionOp()
638 newReg->data->numRects = 0; in RegionOp()
639 if (newSize > newReg->data->size) in RegionOp()
645 * In the upcoming loop, ybot and ytop serve different functions depending in RegionOp()
646 * on whether the band being handled is an overlapping or non-overlapping in RegionOp()
647 * band. in RegionOp()
648 * In the case of a non-overlapping band (only one of the regions in RegionOp()
649 * has points in the band), ybot is the bottom of the most recent in RegionOp()
650 * intersection and thus clips the top of the rectangles in that band. in RegionOp()
652 * serves to clip the bottom of the rectangles in the current band. in RegionOp()
653 * For an overlapping band (where the two regions intersect), ytop clips in RegionOp()
657 ybot = min(r1->y1, r2->y1); in RegionOp()
660 * prevBand serves to mark the start of the previous band so rectangles in RegionOp()
662 * In the beginning, there is no previous band, so prevBand == curBand in RegionOp()
663 * (curBand is set later on, of course, but the first band will always in RegionOp()
672 * This algorithm proceeds one source-band (as opposed to a in RegionOp()
673 * destination band, which is determined by where the two regions in RegionOp()
675 * rectangle after the last one in the current band for their in RegionOp()
685 * First handle the band that doesn't intersect, if any. in RegionOp()
687 * Note that attention is restricted to one band in the in RegionOp()
688 * non-intersecting region at once, so if a region has n in RegionOp()
695 bot = min(r1->y2, r2y1); in RegionOp()
697 curBand = newReg->data->numRects; in RegionOp()
707 bot = min(r2->y2, r1y1); in RegionOp()
709 curBand = newReg->data->numRects; in RegionOp()
721 * Now see if we've hit an intersecting band. The two bands only in RegionOp()
724 ybot = min(r1->y2, r2->y2); in RegionOp()
726 curBand = newReg->data->numRects; in RegionOp()
733 * If we've finished with a band (y2 == ybot) we skip forward in RegionOp()
734 * in the region to the next band. in RegionOp()
736 if (r1->y2 == ybot) in RegionOp()
738 if (r2->y2 == ybot) in RegionOp()
747 * band left. After that, we can just group all remaining boxes, in RegionOp()
754 curBand = newReg->data->numRects; in RegionOp()
755 RegionAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2); in RegionOp()
764 curBand = newReg->data->numRects; in RegionOp()
765 RegionAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2); in RegionOp()
773 if (!(numRects = newReg->data->numRects)) { in RegionOp()
775 newReg->data = &RegionEmptyData; in RegionOp()
778 newReg->extents = *RegionBoxptr(newReg); in RegionOp()
780 newReg->data = NULL; in RegionOp()
789 /*-
790 *-----------------------------------------------------------------------
791 * RegionSetExtents --
802 *-----------------------------------------------------------------------
809 if (!pReg->data) in RegionSetExtents()
811 if (!pReg->data->size) { in RegionSetExtents()
812 pReg->extents.x2 = pReg->extents.x1; in RegionSetExtents()
813 pReg->extents.y2 = pReg->extents.y1; in RegionSetExtents()
821 * Since pBox is the first rectangle in the region, it must have the in RegionSetExtents()
822 * smallest y1 and since pBoxEnd is the last rectangle in the region, in RegionSetExtents()
827 pReg->extents.x1 = pBox->x1; in RegionSetExtents()
828 pReg->extents.y1 = pBox->y1; in RegionSetExtents()
829 pReg->extents.x2 = pBoxEnd->x2; in RegionSetExtents()
830 pReg->extents.y2 = pBoxEnd->y2; in RegionSetExtents()
832 assert(pReg->extents.y1 < pReg->extents.y2); in RegionSetExtents()
834 if (pBox->x1 < pReg->extents.x1) in RegionSetExtents()
835 pReg->extents.x1 = pBox->x1; in RegionSetExtents()
836 if (pBox->x2 > pReg->extents.x2) in RegionSetExtents()
837 pReg->extents.x2 = pBox->x2; in RegionSetExtents()
841 assert(pReg->extents.x1 < pReg->extents.x2); in RegionSetExtents()
847 /*-
848 *-----------------------------------------------------------------------
849 * RegionIntersectO --
850 * Handle an overlapping band for RegionIntersect.
858 *-----------------------------------------------------------------------
863 if (r->x1 <= x2) { \
865 if (r->x1 < x2) *pOverlap = TRUE; \
866 if (x2 < r->x2) x2 = r->x2; \
870 x1 = r->x1; \
871 x2 = r->x2; \
878 /*-
879 *-----------------------------------------------------------------------
880 * RegionUnionO --
881 * Handle an overlapping band for the union operation. Picks the
882 * left-most rectangle each time and merges it into the region.
891 *-----------------------------------------------------------------------
909 if (r1->x1 < r2->x1) { in RegionUnionO()
910 x1 = r1->x1; in RegionUnionO()
911 x2 = r1->x2; in RegionUnionO()
915 x1 = r2->x1; in RegionUnionO()
916 x2 = r2->x2; in RegionUnionO()
920 if (r1->x1 < r2->x1) in RegionUnionO()
948 /*-
949 *-----------------------------------------------------------------------
950 * RegionAppend --
953 * knowledge of YX-banding when it's easy. Otherwise, dstrgn just
954 * becomes a non-y-x-banded random collection of rectangles, and not
975 if (!rgn->data && (dstrgn->data == &RegionEmptyData)) { in RegionAppend()
976 dstrgn->extents = rgn->extents; in RegionAppend()
977 dstrgn->data = NULL; in RegionAppend()
992 dstrgn->extents = rgn->extents; in RegionAppend()
993 else if (dstrgn->extents.x2 > dstrgn->extents.x1) { in RegionAppend()
997 last = RegionBoxptr(dstrgn) + (dnumRects - 1); in RegionAppend()
998 if ((first->y1 > last->y2) || in RegionAppend()
999 ((first->y1 == last->y1) && (first->y2 == last->y2) && in RegionAppend()
1000 (first->x1 > last->x2))) { in RegionAppend()
1001 if (rgn->extents.x1 < dstrgn->extents.x1) in RegionAppend()
1002 dstrgn->extents.x1 = rgn->extents.x1; in RegionAppend()
1003 if (rgn->extents.x2 > dstrgn->extents.x2) in RegionAppend()
1004 dstrgn->extents.x2 = rgn->extents.x2; in RegionAppend()
1005 dstrgn->extents.y2 = rgn->extents.y2; in RegionAppend()
1009 last = old + (numRects - 1); in RegionAppend()
1010 if ((first->y1 > last->y2) || in RegionAppend()
1011 ((first->y1 == last->y1) && (first->y2 == last->y2) && in RegionAppend()
1012 (first->x1 > last->x2))) { in RegionAppend()
1014 if (rgn->extents.x1 < dstrgn->extents.x1) in RegionAppend()
1015 dstrgn->extents.x1 = rgn->extents.x1; in RegionAppend()
1016 if (rgn->extents.x2 > dstrgn->extents.x2) in RegionAppend()
1017 dstrgn->extents.x2 = rgn->extents.x2; in RegionAppend()
1018 dstrgn->extents.y1 = rgn->extents.y1; in RegionAppend()
1021 dstrgn->extents.x2 = dstrgn->extents.x1; in RegionAppend()
1039 dstrgn->data->numRects += numRects; in RegionAppend()
1069 /* Choose partition element, stick in location 0 */ in QuickSortRects()
1083 (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1))); in QuickSortRects()
1086 r--; in QuickSortRects()
1087 j--; in QuickSortRects()
1088 } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1)); in QuickSortRects()
1097 if (numRects - j - 1 > 1) in QuickSortRects()
1098 QuickSortRects(&rects[j + 1], numRects - j - 1); in QuickSortRects()
1103 /*-
1104 *-----------------------------------------------------------------------
1105 * RegionValidate --
1107 * Take a ``region'' which is a non-y-x-banded random collection of
1115 * The passed-in ``region'' may be modified.
1122 * Step 2. Split the rectangles into the minimum number of proper y-x
1125 * this step in an identity tranformation (ala the Box widget),
1132 *-----------------------------------------------------------------------
1138 /* Descriptor for regions under construction in Step 2. */ in RegionValidate()
1147 int numRI; /* Number of entries used in ri */ in RegionValidate()
1148 int sizeRI; /* Number of entries available in ri */ in RegionValidate()
1153 BoxPtr box; /* Current box in rects */ in RegionValidate()
1154 BoxPtr riBox; /* Last box in ri[j].reg */ in RegionValidate()
1159 if (!badreg->data) { in RegionValidate()
1163 numRects = badreg->data->numRects; in RegionValidate()
1170 if (badreg->extents.x1 < badreg->extents.x2) { in RegionValidate()
1173 badreg->data = (RegDataPtr) NULL; in RegionValidate()
1187 /* Set up the first region to be the first rectangle in badreg */ in RegionValidate()
1199 ri[0].reg.data->numRects = 1; in RegionValidate()
1203 in the region to be split up in order to maintain y-x banding, just in RegionValidate()
1207 for (i = numRects; --i > 0;) { in RegionValidate()
1210 for (j = numRI, rit = ri; --j >= 0; rit++) { in RegionValidate()
1211 reg = &rit->reg; in RegionValidate()
1214 if (box->y1 == riBox->y1 && box->y2 == riBox->y2) { in RegionValidate()
1215 /* box is in same band as riBox. Merge or append it */ in RegionValidate()
1216 if (box->x1 <= riBox->x2) { in RegionValidate()
1218 if (box->x1 < riBox->x2) in RegionValidate()
1220 if (box->x2 > riBox->x2) in RegionValidate()
1221 riBox->x2 = box->x2; in RegionValidate()
1226 reg->data->numRects++; in RegionValidate()
1230 else if (box->y1 >= riBox->y2) { in RegionValidate()
1231 /* Put box into new band */ in RegionValidate()
1232 if (reg->extents.x2 < riBox->x2) in RegionValidate()
1233 reg->extents.x2 = riBox->x2; in RegionValidate()
1234 if (reg->extents.x1 > box->x1) in RegionValidate()
1235 reg->extents.x1 = box->x1; in RegionValidate()
1236 Coalesce(reg, rit->prevBand, rit->curBand); in RegionValidate()
1237 rit->curBand = reg->data->numRects; in RegionValidate()
1240 reg->data->numRects++; in RegionValidate()
1246 /* Uh-oh. No regions were appropriate. Create a new one. */ in RegionValidate()
1257 rit->prevBand = 0; in RegionValidate()
1258 rit->curBand = 0; in RegionValidate()
1259 rit->reg.extents = *box; in RegionValidate()
1260 rit->reg.data = NULL; in RegionValidate()
1261 if (!RegionRectAlloc(&rit->reg, (i + numRI) / numRI)) /* MUST force allocation */ in RegionValidate()
1266 /* Make a final pass over each region in order to Coalesce and set in RegionValidate()
1269 for (j = numRI, rit = ri; --j >= 0; rit++) { in RegionValidate()
1270 reg = &rit->reg; in RegionValidate()
1272 reg->extents.y2 = riBox->y2; in RegionValidate()
1273 if (reg->extents.x2 < riBox->x2) in RegionValidate()
1274 reg->extents.x2 = riBox->x2; in RegionValidate()
1275 Coalesce(reg, rit->prevBand, rit->curBand); in RegionValidate()
1276 if (reg->data->numRects == 1) { /* keep unions happy below */ in RegionValidate()
1278 reg->data = NULL; in RegionValidate()
1291 if (hreg->extents.x1 < reg->extents.x1) in RegionValidate()
1292 reg->extents.x1 = hreg->extents.x1; in RegionValidate()
1293 if (hreg->extents.y1 < reg->extents.y1) in RegionValidate()
1294 reg->extents.y1 = hreg->extents.y1; in RegionValidate()
1295 if (hreg->extents.x2 > reg->extents.x2) in RegionValidate()
1296 reg->extents.x2 = hreg->extents.x2; in RegionValidate()
1297 if (hreg->extents.y2 > reg->extents.y2) in RegionValidate()
1298 reg->extents.y2 = hreg->extents.y2; in RegionValidate()
1301 numRI -= half; in RegionValidate()
1331 x1 = prect->x; in RegionFromRects()
1332 y1 = prect->y; in RegionFromRects()
1333 if ((x2 = x1 + (int) prect->width) > MAXSHORT) in RegionFromRects()
1335 if ((y2 = y1 + (int) prect->height) > MAXSHORT) in RegionFromRects()
1338 pRgn->extents.x1 = x1; in RegionFromRects()
1339 pRgn->extents.y1 = y1; in RegionFromRects()
1340 pRgn->extents.x2 = x2; in RegionFromRects()
1341 pRgn->extents.y2 = y2; in RegionFromRects()
1342 pRgn->data = NULL; in RegionFromRects()
1353 for (i = nrects; --i >= 0; prect++) { in RegionFromRects()
1354 x1 = prect->x; in RegionFromRects()
1355 y1 = prect->y; in RegionFromRects()
1356 if ((x2 = x1 + (int) prect->width) > MAXSHORT) in RegionFromRects()
1358 if ((y2 = y1 + (int) prect->height) > MAXSHORT) in RegionFromRects()
1361 pBox->x1 = x1; in RegionFromRects()
1362 pBox->y1 = y1; in RegionFromRects()
1363 pBox->x2 = x2; in RegionFromRects()
1364 pBox->y2 = y2; in RegionFromRects()
1369 pData->size = nrects; in RegionFromRects()
1370 pData->numRects = pBox - (BoxPtr) (pData + 1); in RegionFromRects()
1371 pRgn->data = pData; in RegionFromRects()
1375 pRgn->extents.x1 = pRgn->extents.x2 = 0; in RegionFromRects()