]> icculus.org git repositories - btb/d2x.git/blob - 2d/pixel.c
remove old _3DFX code
[btb/d2x.git] / 2d / pixel.c
1 /* $Id: pixel.c,v 1.6 2004-05-31 08:33:41 btb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14 /*
15  *
16  * Graphical routines for setting a pixel.
17  *
18  */
19
20 #ifdef HAVE_CONFIG_H
21 #include <conf.h>
22 #endif
23
24 #include "u_mem.h"
25
26 #include "gr.h"
27 #include "grdef.h"
28 #ifdef __MSDOS__
29 #include "vesa.h"
30 #include "modex.h"
31 #endif
32 #ifdef OGL
33 #include "ogl_init.h"
34 #endif
35
36
37 #ifndef D1XD3D
38 void gr_upixel( int x, int y )
39 {
40         switch (TYPE)
41         {
42 #ifdef OGL
43         case BM_OGL:
44                 ogl_upixelc(x,y,COLOR);
45                 return;
46 #endif
47         case BM_LINEAR:
48                 DATA[ ROWSIZE*y+x ] = COLOR;
49                 return;
50 #ifdef __DJGPP__
51         case BM_MODEX:
52                 gr_modex_setplane( (x+XOFFSET) & 3 );
53                 gr_video_memory[(ROWSIZE * (y+YOFFSET)) + ((x+XOFFSET)>>2)] = COLOR;
54                 return;
55         case BM_SVGA:
56                 gr_vesa_pixel( COLOR, (unsigned int)DATA + (unsigned int)ROWSIZE * y + x);
57                 return;
58 #endif
59         }
60 }
61 #endif
62
63 void gr_pixel( int x, int y )
64 {
65         if ((x<0) || (y<0) || (x>=GWIDTH) || (y>=GHEIGHT)) return;
66         gr_upixel (x, y);
67 }
68
69 #ifndef D1XD3D
70 inline void gr_bm_upixel( grs_bitmap * bm, int x, int y, unsigned char color )
71 {
72         switch (bm->bm_type)
73         {
74 #ifdef OGL
75         case BM_OGL:
76                 ogl_upixelc(bm->bm_x+x,bm->bm_y+y,color);
77                 return;
78 #endif
79         case BM_LINEAR:
80                 bm->bm_data[ bm->bm_rowsize*y+x ] = color;
81                 return;
82 #ifdef __DJGPP__
83         case BM_MODEX:
84                 x += bm->bm_x;
85                 y += bm->bm_y;
86                 gr_modex_setplane( x & 3 );
87                 gr_video_memory[(bm->bm_rowsize * y) + (x/4)] = color;
88                 return;
89         case BM_SVGA:
90                 gr_vesa_pixel(color,(unsigned int)bm->bm_data + (unsigned int)bm->bm_rowsize * y + x);
91                 return;
92 #endif
93         }
94 }
95 #endif
96
97 void gr_bm_pixel( grs_bitmap * bm, int x, int y, unsigned char color )
98 {
99         if ((x<0) || (y<0) || (x>=bm->bm_w) || (y>=bm->bm_h)) return;
100         gr_bm_upixel (bm, x, y, color);
101 }
102
103