home *** CD-ROM | disk | FTP | other *** search
/ Monster Disc 2: The Best of 1992 / MONSTER2.ISO / prog / djgpp / cbgrx102.a01 / CONTRIB / LIBGRX / TEST / TEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-12  |  2.1 KB  |  78 lines

  1. /**
  2.  ** TEST.C
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24.  
  25. #include "test.h"
  26. #include <time.h>
  27.  
  28.  
  29.  
  30. TESTFUNC(test1)
  31. {
  32.     long x,y;
  33.     int  ii,results[16],res2[16];
  34.     GrContext *xxx;
  35.  
  36.     x = time(NULL);
  37.     y = 0L;
  38.     while(!kbhit()) {
  39.         GrClearScreen(GrWhite());
  40.         GrClearScreen(GrBlack());
  41.         y++;
  42.     }
  43.     x = time(NULL) - x;
  44.     sprintf(exit_message,"%ld screen writes in %ld seconds, transfer rate = %ld Kbytes/sec\n",
  45.         y,
  46.         x,
  47.         (x == 0L) ?
  48.         0L :
  49.         ((long)GrSizeX() * (long)GrSizeY() * y) /
  50.             (x * 1000L) /
  51.             ((GrNumColors() < 256) ? 8 : 1)
  52.     );
  53.     getkey();
  54.     drawing(0,0,GrSizeX(),GrSizeY(),GrWhite(),GrBlack());
  55.     getkey();
  56.     GrClearScreen(GrBlack());
  57.     xxx = GrCreateContext(100,100,NULL,NULL);
  58.     for(ii = 0; ii < 16; ii++) {
  59.         GrPlot(100+5*ii,100,ii);
  60.         results[ii] = GrPixel(100+5*ii,100);
  61.         GrBitBlt(xxx,3+ii,1,NULL,100+5*ii,100,100+5*ii,100,GrWRITE);
  62.         GrSetContext(xxx);
  63.         res2[ii] = GrPixel(3+ii,1);
  64.         GrSetContext(NULL);
  65.     }
  66.     getkey();
  67.     GrSetMode(GR_default_text);
  68.     for(ii = 0; ii < 16; ii++) {
  69.         printf("written pixel: 0x%02x, read back 0x%02x (0x%02x)\n",
  70.         ii,
  71.         results[ii],
  72.         res2[ii]
  73.         );
  74.     }
  75.     getkey();
  76. }
  77.  
  78.