Annotation of researchv9/X11/src/X.V11R1/server/ddx/cfb/cfbwindow.c, revision 1.1.1.1

1.1       root        1: /***********************************************************
                      2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
                      3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
                      4: 
                      5:                         All Rights Reserved
                      6: 
                      7: Permission to use, copy, modify, and distribute this software and its 
                      8: documentation for any purpose and without fee is hereby granted, 
                      9: provided that the above copyright notice appear in all copies and that
                     10: both that copyright notice and this permission notice appear in 
                     11: supporting documentation, and that the names of Digital or MIT not be
                     12: used in advertising or publicity pertaining to distribution of the
                     13: software without specific, written prior permission.  
                     14: 
                     15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     21: SOFTWARE.
                     22: 
                     23: ******************************************************************/
                     24: 
                     25: #include "X.h"
                     26: #include "scrnintstr.h"
                     27: #include "windowstr.h"
                     28: #include "cfb.h"
                     29: #include "mistruct.h"
                     30: #include "regionstr.h"
                     31: 
                     32: extern WindowRec WindowTable[];
                     33: 
                     34: Bool cfbCreateWindow(pWin)
                     35: WindowPtr pWin;
                     36: {
                     37:     cfbPrivWin *pPrivWin;
                     38: 
                     39:     pWin->ClearToBackground = miClearToBackground;
                     40:     pWin->PaintWindowBackground = cfbPaintAreaNone;
                     41:     pWin->PaintWindowBorder = cfbPaintAreaPR;
                     42:     pWin->CopyWindow = cfbCopyWindow;
                     43:     pPrivWin = (cfbPrivWin *)Xalloc(sizeof(cfbPrivWin));
                     44:     pWin->devPrivate = (pointer)pPrivWin;
                     45:     pPrivWin->pRotatedBorder = NullPixmap;
                     46:     pPrivWin->pRotatedBackground = NullPixmap;
                     47:     pPrivWin->fastBackground = 0;
                     48:     pPrivWin->fastBorder = 0;
                     49: 
                     50:     /* backing store stuff 
                     51:        is this ever called with backing store turned on ???
                     52:     */
                     53:     if ((pWin->backingStore == WhenMapped) ||
                     54:        (pWin->backingStore == Always))
                     55:     {
                     56:     }
                     57:     else
                     58:     {
                     59:     }
                     60:     return TRUE;
                     61: }
                     62: 
                     63: Bool cfbDestroyWindow(pWin)
                     64: WindowPtr pWin;
                     65: {
                     66:     cfbPrivWin *pPrivWin;
                     67: 
                     68:     pPrivWin = (cfbPrivWin *)(pWin->devPrivate);
                     69: 
                     70:     /* cfbDestroyPixmap() deals with any NULL pointers */
                     71:     cfbDestroyPixmap(pPrivWin->pRotatedBorder);
                     72:     cfbDestroyPixmap(pPrivWin->pRotatedBackground);
                     73:     Xfree(pWin->devPrivate);
                     74: }
                     75: 
                     76: Bool cfbMapWindow(pWindow)
                     77: WindowPtr pWindow;
                     78: {
                     79: }
                     80: 
                     81: /* (x, y) is the upper left corner of the window on the screen 
                     82:    do we really need to pass this?  (is it a;ready in pWin->absCorner?)
                     83:    we only do the rotation for pixmaps that are 32 bits wide (padded
                     84: or otherwise.)
                     85:    cfbChangeWindowAttributes() has already put a copy of the pixmap
                     86: in pPrivWin->pRotated*
                     87: 
                     88:    HACK ALERT
                     89:    the '> 4' is a messy hack, which ought to be cleaner
                     90: */
                     91: Bool cfbPositionWindow(pWin, x, y)
                     92: WindowPtr pWin;
                     93: int x, y;
                     94: {
                     95:     cfbPrivWin *pPrivWin;
                     96: 
                     97:     pPrivWin = (cfbPrivWin *)(pWin->devPrivate);
                     98:     if (((unsigned)(pWin->backgroundTile) > 4 ) &&
                     99:        (pPrivWin->fastBackground != 0))
                    100:     {
                    101:        cfbXRotatePixmap(pPrivWin->pRotatedBackground,
                    102:                      pWin->absCorner.x - pPrivWin->oldRotate.x);
                    103:        cfbYRotatePixmap(pPrivWin->pRotatedBackground,
                    104:                      pWin->absCorner.y - pPrivWin->oldRotate.y);
                    105:     }
                    106: 
                    107:     if (((unsigned)(pWin->borderTile) > 4 ) &&
                    108:        (pPrivWin->fastBorder != 0))
                    109:     {
                    110:        cfbXRotatePixmap(pPrivWin->pRotatedBorder,
                    111:                      pWin->absCorner.x - pPrivWin->oldRotate.x);
                    112:        cfbYRotatePixmap(pPrivWin->pRotatedBorder,
                    113:                      pWin->absCorner.y - pPrivWin->oldRotate.y);
                    114:     }
                    115:     if ( (((unsigned)(pWin->borderTile) > 4) && 
                    116:          (pPrivWin->fastBorder != 0))
                    117:        ||
                    118:         (((unsigned)(pWin->backgroundTile) > 4) && 
                    119:          (pPrivWin->fastBackground != 0)))
                    120:     {
                    121:        pPrivWin->oldRotate.x = pWin->absCorner.x;
                    122:        pPrivWin->oldRotate.y = pWin->absCorner.y;
                    123:     }
                    124: }
                    125: 
                    126: Bool cfbUnmapWindow(pWindow, x, y)
                    127: WindowPtr pWindow;
                    128: int x, y;
                    129: {
                    130: }
                    131: 
                    132: /* UNCLEAN!
                    133:    this code calls the bitblt helper code directly.
                    134: 
                    135:    cfbCopyWindow copies only the parts of the destination that are
                    136: visible in the source.
                    137: */
                    138: 
                    139: 
                    140: void 
                    141: cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
                    142:     WindowPtr pWin;
                    143:     DDXPointRec ptOldOrg;
                    144:     RegionPtr prgnSrc;
                    145: {
                    146:     DDXPointPtr pptSrc;
                    147:     register DDXPointPtr ppt;
                    148:     RegionPtr prgnDst;
                    149:     register BoxPtr pbox;
                    150:     register int dx, dy;
                    151:     register int i, nbox;
                    152:     WindowPtr pwinRoot;
                    153: 
                    154:     pwinRoot = &WindowTable[pWin->drawable.pScreen->myNum];
                    155: 
                    156:     prgnDst = (* pWin->drawable.pScreen->RegionCreate)(NULL, 
                    157:                                                       pWin->borderClip->numRects);
                    158: 
                    159:     dx = ptOldOrg.x - pWin->absCorner.x;
                    160:     dy = ptOldOrg.y - pWin->absCorner.y;
                    161:     (* pWin->drawable.pScreen->TranslateRegion)(prgnSrc, -dx, -dy);
                    162:     (* pWin->drawable.pScreen->Intersect)(prgnDst, pWin->borderClip, prgnSrc);
                    163: 
                    164:     pbox = prgnDst->rects;
                    165:     nbox = prgnDst->numRects;
                    166:     if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL( prgnDst->numRects *
                    167:       sizeof(DDXPointRec))))
                    168:        return;
                    169:     ppt = pptSrc;
                    170: 
                    171:     for (i=0; i<nbox; i++, ppt++, pbox++)
                    172:     {
                    173:        ppt->x = pbox->x1 + dx;
                    174:        ppt->y = pbox->y1 + dy;
                    175:     }
                    176: 
                    177:     cfbDoBitblt(pwinRoot, pwinRoot, GXcopy, prgnDst, pptSrc);
                    178:     DEALLOCATE_LOCAL(pptSrc);
                    179:     (* pWin->drawable.pScreen->RegionDestroy)(prgnDst);
                    180: }
                    181: 
                    182: 
                    183: 
                    184: /* swap in correct PaintWindow* routine.  If we can use a fast output
                    185: routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy
                    186: of it in devPrivate.
                    187: */
                    188: Bool
                    189: cfbChangeWindowAttributes(pWin, mask)
                    190:     WindowPtr pWin;
                    191:     int mask;
                    192: {
                    193:     register int index;
                    194:     register cfbPrivWin *pPrivWin;
                    195: 
                    196:     pPrivWin = (cfbPrivWin *)(pWin->devPrivate);
                    197:     while(mask)
                    198:     {
                    199:        index = ffs(mask) -1;
                    200:        mask &= ~(index = 1 << index);
                    201:        switch(index)
                    202:        {
                    203:          case CWBackingStore:
                    204: /*
                    205:            if ((pWin->backingStore == WhenMapped) ||
                    206:                (pWin->backingStore == Always))
                    207:            {
                    208:                if (!pWin->devBackingStore)
                    209:                {
                    210:                    pWin->devBackingStore = (pointer)miInitBackingStore(pWin);
                    211:                    if (!pWin->backStorage)
                    212:                       pWin->backStorage = 
                    213:                                   (BackingStorePtr)Xalloc(sizeof(BackingStoreRec));
                    214:                    pWin->backStorage->SaveDoomedAreas = miSaveAreas;
                    215:                    pWin->backStorage->RestoreAreas = miRestoreAreas;
                    216:                    pWin->backStorage->TranslateBackingStore = 
                    217:                                miTranslateBackingStore;
                    218:                }
                    219:            }
                    220:            else
                    221:            {
                    222:                if (pWin->devBackingStore)
                    223:                    miRemoveBackingStore(pWin);
                    224:            }
                    225: */
                    226:            break;
                    227: 
                    228:          case CWBackPixmap:
                    229:              switch((int)pWin->backgroundTile)
                    230:              {
                    231:                case None:
                    232:                  pWin->PaintWindowBackground = cfbPaintAreaNone;
                    233:                  pPrivWin->fastBackground = 0;
                    234:                  break;
                    235:                case ParentRelative:
                    236:                  pWin->PaintWindowBackground = cfbPaintAreaPR;
                    237:                  pPrivWin->fastBackground = 0;
                    238:                  break;
                    239:                default:
                    240:                  if(cfbPadPixmap(pWin->backgroundTile))
                    241:                  {
                    242:                      pPrivWin->fastBackground = 1;
                    243:                      pPrivWin->oldRotate.x = pWin->absCorner.x;
                    244:                      pPrivWin->oldRotate.y = pWin->absCorner.y;
                    245:                      if (pPrivWin->pRotatedBackground)
                    246:                          cfbDestroyPixmap(pPrivWin->pRotatedBackground);
                    247:                      pPrivWin->pRotatedBackground =
                    248:                        cfbCopyPixmap(pWin->backgroundTile);
                    249:                      cfbXRotatePixmap(pPrivWin->pRotatedBackground,
                    250:                                    pWin->absCorner.x);
                    251:                      cfbYRotatePixmap(pPrivWin->pRotatedBackground,
                    252:                                    pWin->absCorner.y);
                    253:                      pWin->PaintWindowBackground = cfbPaintArea32;
                    254:                  }
                    255:                  else
                    256:                  {
                    257:                      pPrivWin->fastBackground = 0;
                    258:                      pWin->PaintWindowBackground = miPaintWindow;
                    259:                  }
                    260:                  break;
                    261:              }
                    262:              break;
                    263: 
                    264:          case CWBackPixel:
                    265:               pWin->PaintWindowBackground = cfbPaintAreaSolid;
                    266:              pPrivWin->fastBackground = 0;
                    267:              break;
                    268: 
                    269:          case CWBorderPixmap:
                    270:              switch((int)pWin->borderTile)
                    271:              {
                    272:                case None:
                    273:                  pWin->PaintWindowBorder = cfbPaintAreaNone;
                    274:                  pPrivWin->fastBorder = 0;
                    275:                  break;
                    276:                case ParentRelative:
                    277:                  pWin->PaintWindowBorder = cfbPaintAreaPR;
                    278:                  pPrivWin->fastBorder = 0;
                    279:                  break;
                    280:                default:
                    281:                  if(cfbPadPixmap(pWin->borderTile))
                    282:                  {
                    283:                      pPrivWin->fastBorder = 1;
                    284:                      pPrivWin->oldRotate.x = pWin->absCorner.x;
                    285:                      pPrivWin->oldRotate.y = pWin->absCorner.y;
                    286:                      if (pPrivWin->pRotatedBorder)
                    287:                          cfbDestroyPixmap(pPrivWin->pRotatedBorder);
                    288:                      pPrivWin->pRotatedBorder =
                    289:                        cfbCopyPixmap(pWin->borderTile);
                    290:                      cfbXRotatePixmap(pPrivWin->pRotatedBorder,
                    291:                                    pWin->absCorner.x);
                    292:                      cfbYRotatePixmap(pPrivWin->pRotatedBorder,
                    293:                                    pWin->absCorner.y);
                    294:                      pWin->PaintWindowBorder = cfbPaintArea32;
                    295:                  }
                    296:                  else
                    297:                  {
                    298:                      pPrivWin->fastBorder = 0;
                    299:                      pWin->PaintWindowBorder = cfbPaintAreaOther;
                    300:                  }
                    301:                  break;
                    302:              }
                    303:              break;
                    304:            case CWBorderPixel:
                    305:              pWin->PaintWindowBorder = cfbPaintAreaSolid;
                    306:              pPrivWin->fastBorder = 0;
                    307:              break;
                    308: 
                    309:        }
                    310:     }
                    311: }
                    312: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.