home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog-asm / talincod.lha / talincode.lha / getdclip.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-20  |  1.1 KB  |  35 lines

  1. /* ======================================================================== *
  2.          GetDClip -- gets the size of the screen, including DisplayClip
  3.                                    By Talin.
  4.                   Compiled under Manx 5.0 with small code/data
  5.  * ======================================================================== */
  6.  
  7. #include <std_headers.h>
  8. #include <graphics/videocontrol.h>
  9.  
  10. struct TagItem vpe_tags[2] = { { VTAG_VIEWPORTEXTRA_GET, NULL }, { TAG_DONE, } };
  11.  
  12. extern struct Library    *GfxBase;
  13.  
  14. void GetDClip(struct Screen *s, struct IBox *result)
  15. {    struct ViewPortExtra *vpe;
  16.  
  17.     result->Left = 0;
  18.     result->Top = 0;
  19.     result->Width = s->Width;
  20.     result->Height = s->Height;
  21.  
  22.     if (GfxBase->lib_Version >= 36)
  23.     {    vpe_tags[0].ti_Data = NULL;
  24.         vpe_tags[0].ti_Tag = VTAG_VIEWPORTEXTRA_GET;
  25.         VideoControl(s->ViewPort.ColorMap,vpe_tags);
  26.  
  27.         if (vpe = (struct ViewPortExtra *)vpe_tags[0].ti_Data)
  28.         {    result->Left = vpe->DisplayClip.MinX;
  29.             result->Top = vpe->DisplayClip.MinY;
  30.             result->Width =  clamp(0,vpe->DisplayClip.MaxX + 1 - vpe->DisplayClip.MinX,s->Width);
  31.             result->Height = clamp(0,vpe->DisplayClip.MaxY + 1 - vpe->DisplayClip.MinY,s->Height);
  32.         }
  33.     }
  34. }
  35.