home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / GRAPH / GHLINE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  962 b   |  50 lines

  1. /* ghline.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */
  2.  
  3. #include <stdlib.h>
  4. #include <memory.h>
  5. #include <graph.h>
  6. #define INCL_VIO
  7. #include <os2emx.h>
  8. #include "graph2.h"
  9.  
  10. void g_hline (int y, int x0, int x1, int color)
  11. {
  12.   int f, n;
  13.  
  14.   if (y >= _g_clipy0 && y <= _g_clipy1)
  15.     {
  16.       f = 1;
  17.       if (x0 < _g_clipx0)
  18.         {
  19.           x0 = _g_clipx0; --f; 
  20.         }
  21.       if (x1 < _g_clipx0)
  22.         {
  23.           if (f == 0)
  24.             return;
  25.           x1 = _g_clipx0;
  26.         }
  27.       f = 1;
  28.       if (x0 > _g_clipx1)
  29.         {
  30.           x0 = _g_clipx1; --f;
  31.         }
  32.       if (x1 > _g_clipx1)
  33.         {
  34.           if (f == 0)
  35.             return;
  36.           x1 = _g_clipx1;
  37.         }
  38.       if (x0 <= x1)
  39.         n = x1 - x0 + 1;
  40.       else
  41.         {
  42.           n = x0 - x1 + 1;
  43.           x0 = x1;
  44.         }
  45.       GLOCK;
  46.       memset (_g_mem + y * 320 + x0, color, n);
  47.       GUNLOCK;
  48.     }
  49. }
  50.