home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / mfb / mfbfillsp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-15  |  32.0 KB  |  1,094 lines

  1. /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
  2. /***********************************************************
  3. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  4. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Digital or MIT not be
  13. used in advertising or publicity pertaining to distribution of the
  14. software without specific, written prior permission.  
  15.  
  16. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  18. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22. SOFTWARE.
  23.  
  24. ******************************************************************/
  25. /* $XConsortium: mfbfillsp.c,v 5.7 90/05/15 18:38:15 keith Exp $ */
  26. #include "X.h"
  27. #include "Xmd.h"
  28. #include "gcstruct.h"
  29. #include "window.h"
  30. #include "pixmapstr.h"
  31. #include "scrnintstr.h"
  32. #include "windowstr.h"
  33. #include "mfb.h"
  34. #include "maskbits.h"
  35.  
  36. #include "mergerop.h"
  37.  
  38. #include "servermd.h"
  39.  
  40. /* scanline filling for monochrome frame buffer
  41.    written by drewry, oct 1986
  42.  
  43.    these routines all clip.  they assume that anything that has called
  44. them has already translated the points (i.e. pGC->miTranslate is
  45. non-zero, which is howit gets set in mfbCreateGC().)
  46.  
  47.    the number of new scnalines created by clipping ==
  48. MaxRectsPerBand * nSpans.
  49.  
  50.     FillSolid is overloaded to be used for OpaqueStipple as well,
  51. if fgPixel == bgPixel.  
  52.  
  53.  
  54.     FillTiled is overloaded to be used for OpaqueStipple, if
  55. fgPixel != bgPixel.  based on the fill style, it uses
  56. {RotatedPixmap, gc.alu} or {RotatedPixmap, PrivGC.ropOpStip}
  57. */
  58.  
  59.  
  60. void mfbBlackSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  61.     DrawablePtr pDrawable;
  62.     GCPtr    pGC;
  63.     int        nInit;            /* number of spans to fill */
  64.     DDXPointPtr pptInit;        /* pointer to list of start points */
  65.     int        *pwidthInit;        /* pointer to list of n widths */
  66.     int     fSorted;
  67. {
  68.                 /* next three parameters are post-clip */
  69.     int n;            /* number of spans to fill */
  70.     register DDXPointPtr ppt;    /* pointer to list of start points */
  71.     register int *pwidth;    /* pointer to list of n widths */
  72.     int *addrlBase;        /* pointer to start of bitmap */
  73.     int nlwidth;        /* width in longwords of bitmap */
  74.     register int *addrl;    /* pointer to current longword in bitmap */
  75.     register int nlmiddle;
  76.     register int startmask;
  77.     register int endmask;
  78.     int *pwidthFree;        /* copies of the pointers to free */
  79.     DDXPointPtr pptFree;
  80.  
  81.     if (!(pGC->planemask & 1))
  82.     return;
  83.  
  84.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  85.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  86.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  87.     if(!pptFree || !pwidthFree)
  88.     {
  89.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  90.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  91.     return;
  92.     }
  93.     pwidth = pwidthFree;
  94.     ppt = pptFree;
  95.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  96.             pptInit, pwidthInit, nInit,
  97.             ppt, pwidth, fSorted);
  98.  
  99.     if (pDrawable->type == DRAWABLE_WINDOW)
  100.     {
  101.     addrlBase = (int *)
  102.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  103.     nlwidth = (int)
  104.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  105.     }
  106.     else
  107.     {
  108.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  109.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  110.     }
  111.  
  112.     while (n--)
  113.     {
  114.         addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  115.  
  116.     if (*pwidth)
  117.     {
  118.         if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  119.         {
  120.         /* all bits inside same longword */
  121.         maskpartialbits(ppt->x, *pwidth, startmask);
  122.             *addrl &= ~startmask;
  123.         }
  124.         else
  125.         {
  126.         maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  127.         if (startmask)
  128.             *addrl++ &= ~startmask;
  129.         Duff (nlmiddle, *addrl++ = 0x0);
  130.         if (endmask)
  131.             *addrl &= ~endmask;
  132.         }
  133.     }
  134.     pwidth++;
  135.     ppt++;
  136.     }
  137.     DEALLOCATE_LOCAL(pptFree);
  138.     DEALLOCATE_LOCAL(pwidthFree);
  139. }
  140.  
  141.  
  142.  
  143. void mfbWhiteSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  144.     DrawablePtr pDrawable;
  145.     GCPtr    pGC;
  146.     int        nInit;            /* number of spans to fill */
  147.     DDXPointPtr pptInit;        /* pointer to list of start points */
  148.     int        *pwidthInit;        /* pointer to list of n widths */
  149.     int     fSorted;
  150. {
  151.                 /* next three parameters are post-clip */
  152.     int n;            /* number of spans to fill */
  153.     register DDXPointPtr ppt;    /* pointer to list of start points */
  154.     register int *pwidth;    /* pointer to list of n widths */
  155.     int *addrlBase;        /* pointer to start of bitmap */
  156.     int nlwidth;        /* width in longwords of bitmap */
  157.     register int *addrl;    /* pointer to current longword in bitmap */
  158.     register int nlmiddle;
  159.     register int startmask;
  160.     register int endmask;
  161.     int *pwidthFree;        /* copies of the pointers to free */
  162.     DDXPointPtr pptFree;
  163.  
  164.     if (!(pGC->planemask & 1))
  165.     return;
  166.  
  167.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  168.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  169.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  170.     if(!pptFree || !pwidthFree)
  171.     {
  172.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  173.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  174.     return;
  175.     }
  176.     pwidth = pwidthFree;
  177.     ppt = pptFree;
  178.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  179.             pptInit, pwidthInit, nInit,
  180.             ppt, pwidth, fSorted);
  181.  
  182.     if (pDrawable->type == DRAWABLE_WINDOW)
  183.     {
  184.     addrlBase = (int *)
  185.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  186.     nlwidth = (int)
  187.          (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  188.     }
  189.     else
  190.     {
  191.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  192.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  193.     }
  194.  
  195.     while (n--)
  196.     {
  197.         addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  198.  
  199.     if (*pwidth)
  200.     {
  201.         if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  202.         {
  203.         /* all bits inside same longword */
  204.         maskpartialbits(ppt->x, *pwidth, startmask);
  205.         *addrl |= startmask;
  206.         }
  207.         else
  208.         {
  209.         maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  210.         if (startmask)
  211.             *addrl++ |= startmask;
  212.         Duff (nlmiddle, *addrl++ = 0xffffffff);
  213.         if (endmask)
  214.             *addrl |= endmask;
  215.         }
  216.     }
  217.     pwidth++;
  218.     ppt++;
  219.     }
  220.     DEALLOCATE_LOCAL(pptFree);
  221.     DEALLOCATE_LOCAL(pwidthFree);
  222. }
  223.  
  224.  
  225.  
  226. void mfbInvertSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  227.     DrawablePtr pDrawable;
  228.     GCPtr    pGC;
  229.     int        nInit;            /* number of spans to fill */
  230.     DDXPointPtr pptInit;        /* pointer to list of start points */
  231.     int        *pwidthInit;        /* pointer to list of n widths */
  232.     int     fSorted;
  233. {
  234.                 /* next three parameters are post-clip */
  235.     int n;            /* number of spans to fill */
  236.     register DDXPointPtr ppt;    /* pointer to list of start points */
  237.     register int *pwidth;    /* pointer to list of n widths */
  238.     int *addrlBase;        /* pointer to start of bitmap */
  239.     int nlwidth;        /* width in longwords of bitmap */
  240.     register int *addrl;    /* pointer to current longword in bitmap */
  241.     register int nlmiddle;
  242.     register int startmask;
  243.     register int endmask;
  244.     int *pwidthFree;        /* copies of the pointers to free */
  245.     DDXPointPtr pptFree;
  246.  
  247.     if (!(pGC->planemask & 1))
  248.     return;
  249.  
  250.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  251.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  252.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  253.     if(!pptFree || !pwidthFree)
  254.     {
  255.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  256.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  257.     return;
  258.     }
  259.     pwidth = pwidthFree;
  260.     ppt = pptFree;
  261.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  262.             pptInit, pwidthInit, nInit,
  263.             ppt, pwidth, fSorted);
  264.  
  265.     if (pDrawable->type == DRAWABLE_WINDOW)
  266.     {
  267.     addrlBase = (int *)
  268.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  269.     nlwidth = (int)
  270.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  271.     }
  272.     else
  273.     {
  274.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  275.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  276.     }
  277.  
  278.     while (n--)
  279.     {
  280.         addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  281.  
  282.     if (*pwidth)
  283.     {
  284.         if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  285.         {
  286.         /* all bits inside same longword */
  287.         maskpartialbits(ppt->x, *pwidth, startmask);
  288.         *addrl ^= startmask;
  289.         }
  290.         else
  291.         {
  292.         maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  293.         if (startmask)
  294.             *addrl++ ^= startmask;
  295.         Duff (nlmiddle, *addrl++ ^= 0xffffffff);
  296.         if (endmask)
  297.             *addrl ^= endmask;
  298.         }
  299.     }
  300.     pwidth++;
  301.     ppt++;
  302.     }
  303.     DEALLOCATE_LOCAL(pptFree);
  304.     DEALLOCATE_LOCAL(pwidthFree);
  305. }
  306.  
  307.  
  308. void 
  309. mfbWhiteStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  310. DrawablePtr pDrawable;
  311. GC *pGC;
  312. int nInit;            /* number of spans to fill */
  313. DDXPointPtr pptInit;        /* pointer to list of start points */
  314. int *pwidthInit;        /* pointer to list of n widths */
  315. int fSorted;
  316. {
  317.                 /* next three parameters are post-clip */
  318.     int n;            /* number of spans to fill */
  319.     register DDXPointPtr ppt;    /* pointer to list of start points */
  320.     register int *pwidth;    /* pointer to list of n widths */
  321.     int *addrlBase;        /* pointer to start of bitmap */
  322.     int nlwidth;        /* width in longwords of bitmap */
  323.     register int *addrl;    /* pointer to current longword in bitmap */
  324.     register int src;
  325.     register int nlmiddle;
  326.     register int startmask;
  327.     register int endmask;
  328.     PixmapPtr pStipple;
  329.     int *psrc;
  330.     int tileHeight;
  331.     int *pwidthFree;        /* copies of the pointers to free */
  332.     DDXPointPtr pptFree;
  333.  
  334.     if (!(pGC->planemask & 1))
  335.     return;
  336.  
  337.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  338.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  339.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  340.     if(!pptFree || !pwidthFree)
  341.     {
  342.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  343.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  344.     return;
  345.     }
  346.     pwidth = pwidthFree;
  347.     ppt = pptFree;
  348.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  349.             pptInit, pwidthInit, nInit, 
  350.             ppt, pwidth, fSorted);
  351.  
  352.     if (pDrawable->type == DRAWABLE_WINDOW)
  353.     {
  354.     addrlBase = (int *)
  355.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  356.     nlwidth = (int)
  357.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  358.     }
  359.     else
  360.     {
  361.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  362.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  363.     }
  364.  
  365.     pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
  366.     tileHeight = pStipple->drawable.height;
  367.     psrc = (int *)(pStipple->devPrivate.ptr);
  368.  
  369.     while (n--)
  370.     {
  371.         addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  372.     src = psrc[ppt->y % tileHeight];
  373.  
  374.         /* all bits inside same longword */
  375.         if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  376.         {
  377.         maskpartialbits(ppt->x, *pwidth, startmask);
  378.         *addrl |= (src & startmask);
  379.         }
  380.         else
  381.         {
  382.         maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  383.         if (startmask)
  384.         *addrl++ |= (src & startmask);
  385.         Duff (nlmiddle, *addrl++ |= src);
  386.         if (endmask)
  387.         *addrl |= (src & endmask);
  388.         }
  389.     pwidth++;
  390.     ppt++;
  391.     }
  392.     DEALLOCATE_LOCAL(pptFree);
  393.     DEALLOCATE_LOCAL(pwidthFree);
  394. }
  395.  
  396.  
  397. void 
  398. mfbBlackStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  399. DrawablePtr pDrawable;
  400. GC *pGC;
  401. int nInit;            /* number of spans to fill */
  402. DDXPointPtr pptInit;        /* pointer to list of start points */
  403. int *pwidthInit;        /* pointer to list of n widths */
  404. int fSorted;
  405. {
  406.                 /* next three parameters are post-clip */
  407.     int n;            /* number of spans to fill */
  408.     register DDXPointPtr ppt;    /* pointer to list of start points */
  409.     register int *pwidth;    /* pointer to list of n widths */
  410.     int *addrlBase;        /* pointer to start of bitmap */
  411.     int nlwidth;        /* width in longwords of bitmap */
  412.     register int *addrl;    /* pointer to current longword in bitmap */
  413.     register int src;
  414.     register int nlmiddle;
  415.     register int startmask;
  416.     register int endmask;
  417.     PixmapPtr pStipple;
  418.     int *psrc;
  419.     int tileHeight;
  420.     int *pwidthFree;        /* copies of the pointers to free */
  421.     DDXPointPtr pptFree;
  422.  
  423.     if (!(pGC->planemask & 1))
  424.     return;
  425.  
  426.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  427.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  428.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  429.     if(!pptFree || !pwidthFree)
  430.     {
  431.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  432.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  433.     return;
  434.     }
  435.     pwidth = pwidthFree;
  436.     ppt = pptFree;
  437.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  438.             pptInit, pwidthInit, nInit, 
  439.             ppt, pwidth, fSorted);
  440.  
  441.     if (pDrawable->type == DRAWABLE_WINDOW)
  442.     {
  443.     addrlBase = (int *)
  444.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  445.     nlwidth = (int)
  446.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  447.     }
  448.     else
  449.     {
  450.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  451.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  452.     }
  453.  
  454.     pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
  455.     tileHeight = pStipple->drawable.height;
  456.     psrc = (int *)(pStipple->devPrivate.ptr);
  457.  
  458.     while (n--)
  459.     {
  460.         addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  461.     src = psrc[ppt->y % tileHeight];
  462.  
  463.         /* all bits inside same longword */
  464.         if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  465.         {
  466.         maskpartialbits(ppt->x, *pwidth, startmask);
  467.         *addrl &= ~(src & startmask);
  468.         }
  469.         else
  470.         {
  471.         maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  472.         if (startmask)
  473.         *addrl++ &= ~(src & startmask);
  474.         Duff (nlmiddle, *addrl++ &= ~src);
  475.         if (endmask)
  476.         *addrl &= ~(src & endmask);
  477.         }
  478.     pwidth++;
  479.     ppt++;
  480.     }
  481.     DEALLOCATE_LOCAL(pptFree);
  482.     DEALLOCATE_LOCAL(pwidthFree);
  483. }
  484.  
  485.  
  486. void 
  487. mfbInvertStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  488. DrawablePtr pDrawable;
  489. GC *pGC;
  490. int nInit;            /* number of spans to fill */
  491. DDXPointPtr pptInit;        /* pointer to list of start points */
  492. int *pwidthInit;        /* pointer to list of n widths */
  493. int fSorted;
  494. {
  495.                 /* next three parameters are post-clip */
  496.     int n;            /* number of spans to fill */
  497.     register DDXPointPtr ppt;    /* pointer to list of start points */
  498.     register int *pwidth;    /* pointer to list of n widths */
  499.     int *addrlBase;        /* pointer to start of bitmap */
  500.     int nlwidth;        /* width in longwords of bitmap */
  501.     register int *addrl;    /* pointer to current longword in bitmap */
  502.     register int src;
  503.     register int nlmiddle;
  504.     register int startmask;
  505.     register int endmask;
  506.     PixmapPtr pStipple;
  507.     int *psrc;
  508.     int tileHeight;
  509.     int *pwidthFree;        /* copies of the pointers to free */
  510.     DDXPointPtr pptFree;
  511.  
  512.     if (!(pGC->planemask & 1))
  513.     return;
  514.  
  515.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  516.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  517.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  518.     if(!pptFree || !pwidthFree)
  519.     {
  520.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  521.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  522.     return;
  523.     }
  524.     pwidth = pwidthFree;
  525.     ppt = pptFree;
  526.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  527.             pptInit, pwidthInit, nInit, 
  528.             ppt, pwidth, fSorted);
  529.  
  530.     if (pDrawable->type == DRAWABLE_WINDOW)
  531.     {
  532.     addrlBase = (int *)
  533.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  534.     nlwidth = (int)
  535.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  536.     }
  537.     else
  538.     {
  539.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  540.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  541.     }
  542.  
  543.     pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
  544.     tileHeight = pStipple->drawable.height;
  545.     psrc = (int *)(pStipple->devPrivate.ptr);
  546.  
  547.     while (n--)
  548.     {
  549.         addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  550.     src = psrc[ppt->y % tileHeight];
  551.  
  552.         /* all bits inside same longword */
  553.         if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  554.         {
  555.         maskpartialbits(ppt->x, *pwidth, startmask);
  556.         *addrl ^= (src & startmask);
  557.         }
  558.         else
  559.         {
  560.         maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  561.         if (startmask)
  562.         *addrl++ ^= (src & startmask);
  563.         Duff(nlmiddle, *addrl++ ^= src);
  564.         if (endmask)
  565.         *addrl ^= (src & endmask);
  566.         }
  567.     pwidth++;
  568.     ppt++;
  569.     }
  570.     DEALLOCATE_LOCAL(pptFree);
  571.     DEALLOCATE_LOCAL(pwidthFree);
  572. }
  573.  
  574.  
  575. /* this works with tiles of width == 32 */
  576. #define FILLSPAN32(ROP) \
  577.     while (n--) \
  578.     { \
  579.     if (*pwidth) \
  580.     { \
  581.             addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5); \
  582.         src = psrc[ppt->y % tileHeight]; \
  583.             if ( ((ppt->x & 0x1f) + *pwidth) < 32) \
  584.             { \
  585.             maskpartialbits(ppt->x, *pwidth, startmask); \
  586.             *addrl = (*addrl & ~startmask) | \
  587.                  (ROP(src, *addrl) & startmask); \
  588.             } \
  589.             else \
  590.             { \
  591.             maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); \
  592.             if (startmask) \
  593.             { \
  594.                 *addrl = (*addrl & ~startmask) | \
  595.                  (ROP(src, *addrl) & startmask); \
  596.             addrl++; \
  597.             } \
  598.             while (nlmiddle--) \
  599.             { \
  600.             *addrl = ROP(src, *addrl); \
  601.             addrl++; \
  602.             } \
  603.             if (endmask) \
  604.                 *addrl = (*addrl & ~endmask) | \
  605.                  (ROP(src, *addrl) & endmask); \
  606.             } \
  607.     } \
  608.     pwidth++; \
  609.     ppt++; \
  610.     }
  611.  
  612.  
  613.  
  614. void mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  615. DrawablePtr pDrawable;
  616. GC *pGC;
  617. int nInit;            /* number of spans to fill */
  618. DDXPointPtr pptInit;        /* pointer to list of start points */
  619. int *pwidthInit;        /* pointer to list of n widths */
  620. int fSorted;
  621. {
  622.                 /* next three parameters are post-clip */
  623.     int n;            /* number of spans to fill */
  624.     register DDXPointPtr ppt;    /* pointer to list of start points */
  625.     register int *pwidth;    /* pointer to list of n widths */
  626.     int *addrlBase;        /* pointer to start of bitmap */
  627.     int nlwidth;        /* width in longwords of bitmap */
  628.     register int *addrl;    /* pointer to current longword in bitmap */
  629.     register int src;
  630.     register int nlmiddle;
  631.     register int startmask;
  632.     register int endmask;
  633.     PixmapPtr pTile;
  634.     int *psrc;
  635.     int tileHeight;
  636.     int rop;
  637.     int *pwidthFree;        /* copies of the pointers to free */
  638.     DDXPointPtr pptFree;
  639.     unsigned long   flip;
  640.  
  641.  
  642.     if (!(pGC->planemask & 1))
  643.     return;
  644.  
  645.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  646.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  647.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  648.     if(!pptFree || !pwidthFree)
  649.     {
  650.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  651.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  652.     return;
  653.     }
  654.     pwidth = pwidthFree;
  655.     ppt = pptFree;
  656.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  657.             pptInit, pwidthInit, nInit, 
  658.             ppt, pwidth, fSorted);
  659.  
  660.     if (pDrawable->type == DRAWABLE_WINDOW)
  661.     {
  662.     addrlBase = (int *)
  663.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  664.     nlwidth = (int)
  665.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  666.     }
  667.     else
  668.     {
  669.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  670.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  671.     }
  672.  
  673.     pTile = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap;
  674.     tileHeight = pTile->drawable.height;
  675.     psrc = (int *)(pTile->devPrivate.ptr);
  676.     if (pGC->fillStyle == FillTiled)
  677.     rop = pGC->alu;
  678.     else
  679.     rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip;
  680.  
  681.     flip = 0;
  682.     switch(rop)
  683.     {
  684.       case GXcopyInverted:  /* for opaque stipples */
  685.     flip = ~0;
  686.       case GXcopy:
  687.     {
  688.  
  689. #define DoMaskCopyRop(src,dst,mask)    ((dst) & ~(mask) | (src) & (mask))
  690.  
  691.         while (n--)
  692.         {
  693.             if (*pwidth)
  694.             {
  695.                     addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  696.                 src = psrc[ppt->y % tileHeight] ^ flip;
  697.                     if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  698.                     {
  699.                     maskpartialbits(ppt->x, *pwidth, startmask);
  700.             *addrl = DoMaskCopyRop (src, *addrl, startmask);
  701.                     }
  702.                     else
  703.                     {
  704.                     maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  705.                     if (startmask)
  706.                     {
  707.                 *addrl = DoMaskCopyRop (src, *addrl, startmask);
  708.                     addrl++;
  709.                     }
  710.                     while (nlmiddle--)
  711.                     {
  712.                 *addrl = src;
  713.                     addrl++;
  714.                     }
  715.                     if (endmask)
  716.                 *addrl = DoMaskCopyRop (src, *addrl, endmask);
  717.                     }
  718.             }
  719.             pwidth++;
  720.             ppt++;
  721.         }
  722.     }
  723.     break;
  724.       default:
  725.     {
  726.         register DeclareMergeRop ();
  727.  
  728.         InitializeMergeRop(rop,~0);
  729.         while (n--)
  730.         {
  731.             if (*pwidth)
  732.             {
  733.                     addrl = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  734.                 src = psrc[ppt->y % tileHeight];
  735.                     if ( ((ppt->x & 0x1f) + *pwidth) < 32)
  736.                     {
  737.                     maskpartialbits(ppt->x, *pwidth, startmask);
  738.             *addrl = DoMaskMergeRop (src, *addrl, startmask);
  739.                     }
  740.                     else
  741.                     {
  742.                     maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
  743.                     if (startmask)
  744.                     {
  745.                 *addrl = DoMaskMergeRop (src, *addrl, startmask);
  746.                     addrl++;
  747.                     }
  748.                     while (nlmiddle--)
  749.                     {
  750.                 *addrl = DoMergeRop (src, *addrl);
  751.                     addrl++;
  752.                     }
  753.                     if (endmask)
  754.                 *addrl = DoMaskMergeRop (src, *addrl, endmask);
  755.                     }
  756.             }
  757.             pwidth++;
  758.             ppt++;
  759.         }
  760.     }
  761.     break;
  762.     }
  763.     DEALLOCATE_LOCAL(pptFree);
  764.     DEALLOCATE_LOCAL(pwidthFree);
  765. }
  766.  
  767.  
  768. /* Fill spans with tiles that aren't 32 bits wide */
  769. void
  770. mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  771. DrawablePtr pDrawable;
  772. GC        *pGC;
  773. int        nInit;        /* number of spans to fill */
  774. DDXPointPtr pptInit;        /* pointer to list of start points */
  775. int *pwidthInit;        /* pointer to list of n widths */
  776. int fSorted;
  777. {
  778.     int        iline;        /* first line of tile to use */
  779.                 /* next three parameters are post-clip */
  780.     int n;            /* number of spans to fill */
  781.     register DDXPointPtr ppt;    /* pointer to list of start points */
  782.     register int *pwidth;    /* pointer to list of n widths */
  783.     unsigned int *addrlBase;    /* pointer to start of bitmap */
  784.     int         nlwidth;    /* width in longwords of bitmap */
  785.     register unsigned int *pdst;/* pointer to current word in bitmap */
  786.     register unsigned int *psrc;/* pointer to current word in tile */
  787.     register int nlMiddle;
  788.     register int rop, nstart;
  789.     unsigned int startmask;
  790.     PixmapPtr    pTile;        /* pointer to tile we want to fill with */
  791.     int        w, width, x, xSrc, ySrc, srcStartOver, nend;
  792.     int     tlwidth, rem, tileWidth, tileHeight, endinc;
  793.     unsigned int      endmask, *psrcT;
  794.     int *pwidthFree;        /* copies of the pointers to free */
  795.     DDXPointPtr pptFree;
  796.  
  797.     if (!(pGC->planemask & 1))
  798.     return;
  799.  
  800.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  801.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  802.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  803.     if(!pptFree || !pwidthFree)
  804.     {
  805.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  806.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  807.     return;
  808.     }
  809.     pwidth = pwidthFree;
  810.     ppt = pptFree;
  811.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  812.             pptInit, pwidthInit, nInit, 
  813.             ppt, pwidth, fSorted);
  814.  
  815.     if (pGC->fillStyle == FillTiled)
  816.     {
  817.     pTile = pGC->tile.pixmap;
  818.     tlwidth = pTile->devKind >> 2;
  819.     rop = pGC->alu;
  820.     }
  821.     else
  822.     {
  823.     pTile = pGC->stipple;
  824.     tlwidth = pTile->devKind >> 2;
  825.     rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip;
  826.     }
  827.  
  828.     xSrc = pDrawable->x;
  829.     ySrc = pDrawable->y;
  830.  
  831.     if (pDrawable->type == DRAWABLE_WINDOW)
  832.     {
  833.     addrlBase = (unsigned int *)
  834.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  835.     nlwidth = (int)
  836.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  837.     }
  838.     else
  839.     {
  840.     addrlBase = (unsigned int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  841.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  842.     }
  843.  
  844.     tileWidth = pTile->drawable.width;
  845.     tileHeight = pTile->drawable.height;
  846.  
  847.     /* this replaces rotating the tile. Instead we just adjust the offset
  848.      * at which we start grabbing bits from the tile.
  849.      * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
  850.      * so that iline and rem always stay within the tile bounds.
  851.      */
  852.     xSrc += (pGC->patOrg.x % tileWidth) - tileWidth;
  853.     ySrc += (pGC->patOrg.y % tileHeight) - tileHeight;
  854.  
  855.     while (n--)
  856.     {
  857.     iline = (ppt->y - ySrc) % tileHeight;
  858.         pdst = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  859.         psrcT = (unsigned int *) pTile->devPrivate.ptr + (iline * tlwidth);
  860.     x = ppt->x;
  861.  
  862.     if (*pwidth)
  863.     {
  864.         width = *pwidth;
  865.         while(width > 0)
  866.         {
  867.         psrc = psrcT;
  868.             w = min(tileWidth, width);
  869.         if((rem = (x - xSrc)  % tileWidth) != 0)
  870.         {
  871.             /* if we're in the middle of the tile, get
  872.                as many bits as will finish the span, or
  873.                as many as will get to the left edge of the tile,
  874.                or a longword worth, starting at the appropriate
  875.                offset in the tile.
  876.             */
  877.             w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_UNIT);
  878.             endinc = rem / BITMAP_SCANLINE_UNIT;
  879.             getandputrop((psrc+endinc), (rem&0x1f), (x & 0x1f), w, pdst, rop);
  880.             if((x & 0x1f) + w >= 0x20)
  881.             pdst++;
  882.         }
  883.         else if(((x & 0x1f) + w) < 32)
  884.         {
  885.             /* doing < 32 bits is easy, and worth special-casing */
  886.             putbitsrop(*psrc, x & 0x1f, w, pdst, rop);
  887.         }
  888.         else
  889.         {
  890.             /* start at the left edge of the tile,
  891.                and put down as much as we can
  892.             */
  893.             maskbits(x, w, startmask, endmask, nlMiddle);
  894.  
  895.                 if (startmask)
  896.                 nstart = 32 - (x & 0x1f);
  897.                 else
  898.                 nstart = 0;
  899.                 if (endmask)
  900.                     nend = (x + w)  & 0x1f;
  901.                 else
  902.                 nend = 0;
  903.  
  904.                 srcStartOver = nstart > 31;
  905.  
  906.             if(startmask)
  907.             {
  908.             putbitsrop(*psrc, (x & 0x1f), nstart, pdst, rop);
  909.             pdst++;
  910.             if(srcStartOver)
  911.                 psrc++;
  912.             }
  913.              
  914.             while(nlMiddle--)
  915.             {
  916.                 getandputrop0(psrc, nstart, 32, pdst, rop);
  917.                 pdst++;
  918.                 psrc++;
  919.             }
  920.             if(endmask)
  921.             {
  922.             getandputrop0(psrc, nstart, nend, pdst, rop);
  923.             }
  924.          }
  925.          x += w;
  926.          width -= w;
  927.         }
  928.     }
  929.     ppt++;
  930.     pwidth++;
  931.     }
  932.     DEALLOCATE_LOCAL(pptFree);
  933.     DEALLOCATE_LOCAL(pwidthFree);
  934. }
  935.  
  936.  
  937. /* Fill spans with stipples that aren't 32 bits wide */
  938. void
  939. mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
  940. DrawablePtr pDrawable;
  941. GC        *pGC;
  942. int        nInit;        /* number of spans to fill */
  943. DDXPointPtr pptInit;        /* pointer to list of start points */
  944. int *pwidthInit;        /* pointer to list of n widths */
  945. int fSorted;
  946. {
  947.                 /* next three parameters are post-clip */
  948.     int n;            /* number of spans to fill */
  949.     register DDXPointPtr ppt;    /* pointer to list of start points */
  950.     register int *pwidth;    /* pointer to list of n widths */
  951.     int        iline;        /* first line of tile to use */
  952.     int        *addrlBase;    /* pointer to start of bitmap */
  953.     int         nlwidth;    /* width in longwords of bitmap */
  954.     register int *pdst;        /* pointer to current word in bitmap */
  955.     register int *psrc;        /* pointer to current word in tile */
  956.     register int nlMiddle;
  957.     register int rop, nstart;
  958.     int startmask;
  959.     PixmapPtr    pTile;        /* pointer to tile we want to fill with */
  960.     int        w, width,  x, xSrc, ySrc, srcStartOver, nend;
  961.     int     endmask, tlwidth, rem, tileWidth, *psrcT, endinc;
  962.     int        tileHeight;
  963.     int *pwidthFree;        /* copies of the pointers to free */
  964.     DDXPointPtr pptFree;
  965.  
  966.     if (!(pGC->planemask & 1))
  967.     return;
  968.  
  969.     n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip);
  970.     pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
  971.     pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
  972.     if(!pptFree || !pwidthFree)
  973.     {
  974.     if (pptFree) DEALLOCATE_LOCAL(pptFree);
  975.     if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
  976.     return;
  977.     }
  978.     pwidth = pwidthFree;
  979.     ppt = pptFree;
  980.     n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip,
  981.             pptInit, pwidthInit, nInit, 
  982.             ppt, pwidth, fSorted);
  983.  
  984.     pTile = pGC->stipple;
  985.     rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop;
  986.     tlwidth = pTile->devKind >> 2;
  987.     xSrc = pDrawable->x;
  988.     ySrc = pDrawable->y;
  989.     if (pDrawable->type == DRAWABLE_WINDOW)
  990.     {
  991.     addrlBase = (int *)
  992.         (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
  993.     nlwidth = (int)
  994.           (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
  995.     }
  996.     else
  997.     {
  998.     addrlBase = (int *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
  999.     nlwidth = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
  1000.     }
  1001.  
  1002.     tileWidth = pTile->drawable.width;
  1003.     tileHeight = pTile->drawable.height;
  1004.  
  1005.     /* this replaces rotating the stipple.  Instead, we just adjust the offset
  1006.      * at which we start grabbing bits from the stipple.
  1007.      * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
  1008.      * so that iline and rem always stay within the tile bounds.
  1009.      */
  1010.     xSrc += (pGC->patOrg.x % tileWidth) - tileWidth;
  1011.     ySrc += (pGC->patOrg.y % tileHeight) - tileHeight;
  1012.     while (n--)
  1013.     {
  1014.     iline = (ppt->y - ySrc) % tileHeight;
  1015.         pdst = addrlBase + (ppt->y * nlwidth) + (ppt->x >> 5);
  1016.         psrcT = (int *) pTile->devPrivate.ptr + (iline * tlwidth);
  1017.     x = ppt->x;
  1018.  
  1019.     if (*pwidth)
  1020.     {
  1021.         width = *pwidth;
  1022.         while(width > 0)
  1023.         {
  1024.         psrc = psrcT;
  1025.             w = min(tileWidth, width);
  1026.         if((rem = (x - xSrc) % tileWidth) != 0)
  1027.         {
  1028.             /* if we're in the middle of the tile, get
  1029.                as many bits as will finish the span, or
  1030.                as many as will get to the left edge of the tile,
  1031.                or a longword worth, starting at the appropriate
  1032.                offset in the tile.
  1033.             */
  1034.             w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_UNIT);
  1035.             endinc = rem / BITMAP_SCANLINE_UNIT;
  1036.             getandputrrop((psrc + endinc), (rem & 0x1f), (x & 0x1f),
  1037.                  w, pdst, rop)
  1038.             if((x & 0x1f) + w >= 0x20)
  1039.             pdst++;
  1040.         }
  1041.  
  1042.         else if(((x & 0x1f) + w) < 32)
  1043.         {
  1044.             /* doing < 32 bits is easy, and worth special-casing */
  1045.             putbitsrrop(*psrc, x & 0x1f, w, pdst, rop);
  1046.         }
  1047.         else
  1048.         {
  1049.             /* start at the left edge of the tile,
  1050.                and put down as much as we can
  1051.             */
  1052.             maskbits(x, w, startmask, endmask, nlMiddle);
  1053.  
  1054.                 if (startmask)
  1055.                 nstart = 32 - (x & 0x1f);
  1056.                 else
  1057.                 nstart = 0;
  1058.                 if (endmask)
  1059.                     nend = (x + w)  & 0x1f;
  1060.                 else
  1061.                 nend = 0;
  1062.  
  1063.                 srcStartOver = nstart > 31;
  1064.  
  1065.             if(startmask)
  1066.             {
  1067.             putbitsrrop(*psrc, (x & 0x1f), nstart, pdst, rop);
  1068.             pdst++;
  1069.             if(srcStartOver)
  1070.                 psrc++;
  1071.             }
  1072.              
  1073.             while(nlMiddle--)
  1074.             {
  1075.                 getandputrrop0(psrc, nstart, 32, pdst, rop);
  1076.                 pdst++;
  1077.                 psrc++;
  1078.             }
  1079.             if(endmask)
  1080.             {
  1081.             getandputrrop0(psrc, nstart, nend, pdst, rop);
  1082.             }
  1083.          }
  1084.          x += w;
  1085.          width -= w;
  1086.         }
  1087.     }
  1088.     ppt++;
  1089.     pwidth++;
  1090.     }
  1091.     DEALLOCATE_LOCAL(pptFree);
  1092.     DEALLOCATE_LOCAL(pwidthFree);
  1093. }
  1094.