home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / DIGPMCLI.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  1.7 KB  |  65 lines

  1. /*
  2.     digpmcli.c
  3.  
  4.     % RAM driver stuff
  5.  
  6.     10/4/88 Ted  Extracted from pcramdra.c
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.     01/10/89 ted    Removed redundant disp clip.
  15.     02/10/89 ted    Renamed from pcramcpy for sharing
  16. */
  17.  
  18. #include "oakhead.h"
  19. #include "disppriv.h"
  20. #include "digutil.h"
  21. /* -------------------------------------------------------------------------- */
  22.  
  23. boolean DIGPRIV copypm_clip(ptd, pixmap, pmboxp, scrboxp, pmxp, pmyp)
  24.     ptd_struct *ptd;
  25.     pmap_type pixmap;
  26.     opbox *pmboxp;
  27.     opbox *scrboxp;
  28.     opcoord *pmxp;
  29.     opcoord *pmyp;
  30. /*
  31.     Do all the clipping for copying a pixmap region to or from the display.
  32.     Returns TRUE if some box is common to display and pixmap that can be copied.
  33. */
  34. {
  35.     win_type win;
  36.     opcoord pmorgx, pmorgy;
  37.  
  38.     win = ptd->win;
  39.  
  40. /* Set up box in  screen coordinates */
  41.     opbox_copy(scrboxp, ptd->relboxp);
  42.     opbox_trans(scrboxp, win_GetXmin(win), win_GetYmin(win));
  43.  
  44. /* Construct vector from vid box origin to pixmap box origin */
  45.     pmorgx = pmboxp->xmin - scrboxp->xmin;
  46.     pmorgy = pmboxp->ymin - scrboxp->ymin;
  47.  
  48. /* Put scrbox to position in pmap, now clip it to pmap and pmboxp */
  49.     opbox_trans(scrboxp, pmorgx, pmorgy);
  50.     if (!pmap_clipbox(pixmap, scrboxp)) {
  51.         return(FALSE);    /* bomb if no pmap in box */
  52.     }
  53.     if (!opbox_clipbox(pmboxp, scrboxp)) {
  54.         return(FALSE);    /* bomb if empty pmbox */
  55.     }
  56.     *pmxp = scrboxp->xmin;
  57.     *pmyp = scrboxp->ymin;
  58.  
  59. /* Now return triple clipped scrbox to its old site in display */
  60.     opbox_trans(scrboxp, -pmorgx, -pmorgy);
  61.     return(TRUE);
  62. }
  63. /* -------------------------------------------------------------------------- */
  64.  
  65.