home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ppc / ppcBStore.c < prev    next >
C/C++ Source or Header  |  1989-11-14  |  6KB  |  167 lines

  1. /*
  2.  * Copyright IBM Corporation 1987,1988,1989
  3.  *
  4.  * All Rights Reserved
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted,
  8.  * provided that the above copyright notice appear in all copies and that 
  9.  * both that copyright notice and this permission notice appear in
  10.  * supporting documentation, and that the name of IBM not be
  11.  * used in advertising or publicity pertaining to distribution of the
  12.  * software without specific, written prior permission.
  13.  *
  14.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20.  * SOFTWARE.
  21.  *
  22. */
  23. /***********************************************************
  24.  
  25. Copyright 1987 by the Regents of the University of California
  26. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  27.  
  28.             All Rights Reserved
  29.  
  30. Permission to use, copy, modify, and distribute this software and its
  31. documentation for any purpose and without fee is hereby granted,
  32. provided that the above copyright notice appear in all copies and that
  33. both that copyright notice and this permission notice appear in
  34. supporting documentation, and that the names of Digital or MIT not be
  35. used in advertising or publicity pertaining to distribution of the
  36. software without specific, written prior permission.
  37. ******************************************************************/
  38. /***********************************************************
  39.         Copyright IBM Corporation 1987
  40.  
  41.             All Rights Reserved
  42.  
  43. Permission to use, copy, modify, and distribute this software and its
  44. documentation for any purpose and without fee is hereby granted,
  45. provided that the above copyright notice appear in all copies and that
  46. both that copyright notice and this permission notice appear in
  47. supporting documentation, and that the name of IBM not be
  48. used in advertising or publicity pertaining to distribution of the
  49. software without specific, written prior permission.
  50.  
  51. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  52. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  53. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  54. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  55. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  56. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  57. SOFTWARE.
  58.  
  59. ******************************************************************/
  60.  
  61. /* $Header: */
  62. #ifndef lint
  63. static char *rcsid = "$Header: /andrew/X11/r3src/release/server/ddx/ibm/ppc/RCS/ppcBStore.c,v 30.0 89/01/23 19:29:01 paul Exp $";
  64. #endif
  65.  
  66. #include "X.h"
  67. #include "servermd.h"
  68. #include "regionstr.h"
  69. #include "scrnintstr.h"
  70. #include "pixmapstr.h"
  71. #include "windowstr.h"
  72.  
  73. #include "mibstore.h"
  74. #include "mfb.h"
  75.  
  76. #include "ppc.h"
  77.  
  78. #include "ibmTrace.h"
  79.  
  80. /*-----------------------------------------------------------------------
  81.  * ppcSaveAreas --
  82.  *    Function called by miSaveAreas to actually fetch the areas to be
  83.  *    saved into the backing pixmap.
  84.  *
  85.  * Results:
  86.  *    None.
  87.  *
  88.  * Side Effects:
  89.  *    Data are copied from the screen into the pixmap.
  90.  *
  91.  *-----------------------------------------------------------------------
  92.  */
  93. void
  94. ppcSaveAreas( pPixmap, prgnSave, xorg, yorg )
  95.     register PixmapPtr pPixmap ; /* Backing pixmap */
  96.     RegionPtr prgnSave ;    /* Region to save (pixmap-relative) */
  97.     int xorg ;            /* X origin of region */
  98.     int yorg ;            /* Y origin of region */
  99. {
  100.     register BoxPtr pBox ;
  101.     register int nBox ;
  102.     register void (*pFn)() ;
  103.  
  104.     TRACE( ( "ppcSaveAreas(0x%x,0x%x,%d,%d)\n",
  105.        pPixmap, prgnSave, xorg, yorg ) ) ;
  106. /* WHOOP WHOOP WHOOP XXX -- depth 8 *only* */
  107.  
  108.     if ( !( nBox = REGION_NUM_RECTS(prgnSave) ) )
  109.     return ;
  110.  
  111.     pFn = ( (ppcScrnPriv *) pPixmap->drawable.pScreen->devPrivate )->imageRead ;
  112.     for ( pBox = REGION_RECTS(prgnSave) ; nBox-- ; pBox++ )
  113.     (* pFn)( pBox->x1 + xorg,
  114.          pBox->y1 + yorg,
  115.          pBox->x2 - pBox->x1,
  116.          pBox->y2 - pBox->y1,
  117.          ( (unsigned char *) pPixmap->devPrivate.ptr )
  118.          + ( pBox->y1 * pPixmap->devKind ) + pBox->x1,
  119.          pPixmap->devKind ) ;
  120.  
  121.     return ;
  122. }
  123.  
  124. /*-----------------------------------------------------------------------
  125.  * ppcRestoreAreas --
  126.  *    Function called by miRestoreAreas to actually fetch the areas to be
  127.  *    restored from the backing pixmap.
  128.  *
  129.  * Results:
  130.  *    None.
  131.  *
  132.  * Side Effects:
  133.  *    Data are copied from the pixmap into the screen.
  134.  *
  135.  *-----------------------------------------------------------------------
  136.  */
  137. void
  138. ppcRestoreAreas( pPixmap, prgnRestore, xorg, yorg )
  139.     register PixmapPtr pPixmap ; /* Backing pixmap */
  140.     RegionPtr prgnRestore ;    /* Region to restore (screen-relative)*/
  141.     int xorg ;            /* X origin of window */
  142.     int yorg ;            /* Y origin of window */
  143. {
  144.     register BoxPtr pBox ;
  145.     register int nBox ;
  146.     register void (*pFn)() ;
  147.  
  148.     TRACE( ( "ppcRestoreAreas(0x%x,0x%x,%d,%d)\n",
  149.        pPixmap, prgnRestore, xorg, yorg ) ) ;
  150. /* WHOOP WHOOP WHOOP XXX -- depth 8 *only* */
  151.  
  152.     if ( !( nBox = REGION_NUM_RECTS(prgnRestore) ) )
  153.     return ;
  154.     pFn = ( (ppcScrnPriv *) pPixmap->drawable.pScreen->devPrivate )->imageFill ;
  155.     for ( pBox = REGION_RECTS(prgnRestore) ; nBox-- ; pBox++ )
  156.     (* pFn)( pBox->x1,
  157.          pBox->y1,
  158.          pBox->x2 - pBox->x1,
  159.          pBox->y2 - pBox->y1,
  160.          ( (unsigned char *) pPixmap->devPrivate.ptr )
  161.          + ( ( pBox->y1 - yorg ) * pPixmap->devKind )
  162.          + ( pBox->x1 - xorg ),
  163.          pPixmap->devKind,
  164.          GXcopy, ~0 ) ;
  165.     return ;
  166. }
  167.