--- OLD/xc/programs/Xserver/mi/miwideline.c Thu Jan 1 00:00:00 1970 +++ NEW/xc/programs/Xserver/mi/miwideline.c Thu Jan 1 00:00:00 1970 @@ -1,3 +1,4 @@ +#define MAX_SPANS 64 /* $TOG: miwideline.c /main/60 1998/03/07 17:40:23 kaleb $ */ /* @@ -87,16 +88,20 @@ XID oldPixel; int xorg; Spans spanRec; + int nspan; + int spanx; left_height = 0; right_height = 0; if (!spanData) { - pptInit = (DDXPointPtr) ALLOCATE_LOCAL (overall_height * sizeof(*ppt)); + nspan = MAX_SPANS; + if (nspan > overall_height) nspan = overall_height; + pptInit = (DDXPointPtr) ALLOCATE_LOCAL (nspan * sizeof(*ppt)); if (!pptInit) return; - pwidthInit = (int *) ALLOCATE_LOCAL (overall_height * sizeof(*pwidth)); + pwidthInit = (int *) ALLOCATE_LOCAL (nspan * sizeof(*pwidth)); if (!pwidthInit) { DEALLOCATE_LOCAL (pptInit); @@ -113,6 +118,7 @@ } else { + nspan = overall_height; spanRec.points = (DDXPointPtr) xalloc (overall_height * sizeof (*ppt)); if (!spanRec.points) return; @@ -125,6 +131,7 @@ ppt = spanRec.points; pwidth = spanRec.widths; } + spanx = 0; xorg = 0; if (pGC->miTranslate) @@ -149,10 +156,14 @@ { if (right_x >= left_x) { - ppt->y = y; - ppt->x = left_x + xorg; - ppt++; - *pwidth++ = right_x - left_x + 1; + if (spanx >= nspan) + { (*pGC->ops->FillSpans) (pDrawable, pGC, spanx, pptInit, pwidthInit, TRUE); + spanx = 0; + } + ppt[spanx].y = y; + ppt[spanx].x = left_x + xorg; + pwidth[spanx] = right_x - left_x + 1; + spanx ++; } y++; @@ -163,7 +174,9 @@ } if (!spanData) { - (*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE); + if (spanx > 0) + { (*pGC->ops->FillSpans) (pDrawable, pGC, spanx, pptInit, pwidthInit, TRUE); + } DEALLOCATE_LOCAL (pwidthInit); DEALLOCATE_LOCAL (pptInit); if (pixel != oldPixel)