return ClipGDI->EnumPos < ClipGDI->EnumRects.c;
}
-BOOLEAN FASTCALL
-ClipobjToSpans(
- PSPAN *Spans,
- UINT *Count,
- CLIPOBJ *ClipRegion,
- PRECTL Boundary)
-{
- BOOL EnumMore;
- UINT i, NewCount;
- RECT_ENUM RectEnum;
- PSPAN NewSpans;
- RECTL *Rect;
-
- ASSERT(Boundary->top <= Boundary->bottom && Boundary->left <= Boundary->right);
-
- *Count = Boundary->bottom - Boundary->top;
- if (*Count > 0)
- {
- *Spans = ExAllocatePoolWithTag(PagedPool, *Count * sizeof(SPAN), GDITAG_CLIPOBJ);
- if (NULL == *Spans)
- {
- *Count = 0;
- return FALSE;
- }
- }
-
- if (NULL == ClipRegion || DC_TRIVIAL == ClipRegion->iDComplexity)
- {
- if (0 != *Count)
- {
- for (i = 0; i < Boundary->bottom - Boundary->top; i++)
- {
- (*Spans)[i].X = Boundary->left;
- (*Spans)[i].Y = Boundary->top + i;
- (*Spans)[i].Width = Boundary->right - Boundary->left;
- }
- }
- return TRUE;
- }
-
- *Count = 0;
- CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0);
- do
- {
- EnumMore = CLIPOBJ_bEnum(ClipRegion, (ULONG) sizeof(RECT_ENUM), (PVOID) &RectEnum);
-
- NewCount = *Count;
- for (i = 0; i < RectEnum.c; i++)
- {
- NewCount += RectEnum.arcl[i].bottom - RectEnum.arcl[i].top;
- }
- if (NewCount != *Count)
- {
- NewSpans = ExAllocatePoolWithTag(PagedPool, NewCount * sizeof(SPAN), GDITAG_CLIPOBJ);
- if (NULL == NewSpans)
- {
- if (NULL != *Spans)
- {
- ExFreePoolWithTag(*Spans, GDITAG_CLIPOBJ);
- *Spans = NULL;
- }
- *Count = 0;
- return FALSE;
- }
- if (0 != *Count)
- {
- PSPAN dest, src;
- UINT i = *Count;
- for(dest = NewSpans, src = *Spans;i > 0; i--)
- {
- *dest++ = *src++;
- }
- ExFreePoolWithTag(*Spans, GDITAG_CLIPOBJ);
- }
- *Spans = NewSpans;
- }
- for (Rect = RectEnum.arcl; Rect < RectEnum.arcl + RectEnum.c; Rect++)
- {
- for (i = 0; i < Rect->bottom - Rect->top; i++)
- {
- (*Spans)[*Count].X = Rect->left;
- (*Spans)[*Count].Y = Rect->top + i;
- (*Spans)[*Count].Width = Rect->right - Rect->left;
- (*Count)++;
- }
- }
- ASSERT(*Count == NewCount);
- }
- while (EnumMore);
-
- if (0 != *Count)
- {
- EngSort((PBYTE) *Spans, sizeof(SPAN), *Count, (SORTCOMP) CompareSpans);
- }
-
- return TRUE;
-}
-
/* EOF */