2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Graphics/Rect.cpp $
15 * Routines to draw rectangles.
18 * Revision 1.2 2002/06/09 04:41:18 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:09 root
25 * 3 12/02/98 5:47p Dave
26 * Put in interface xstr code. Converted barracks screen to new format.
28 * 2 10/07/98 10:53a Dave
31 * 1 10/07/98 10:49a Dave
33 * 3 3/10/98 4:18p John
34 * Cleaned up graphics lib. Took out most unused gr functions. Made D3D
35 * & Glide have popups and print screen. Took out all >8bpp software
36 * support. Made Fred zbuffer. Made zbuffer allocate dynamically to
37 * support Fred. Made zbuffering key off of functions rather than one
40 * 2 10/26/96 2:56p John
41 * Got gradient code working.
43 * 1 10/26/96 1:32p John
50 #include "grinternal.h"
52 void grx_rect(int x,int y,int w,int h)
82 // Check for completely offscreen!
83 if ( x1 > gr_screen.clip_right )
86 if ( x2 < gr_screen.clip_left )
89 if ( y1 > gr_screen.clip_bottom )
92 if ( y2 < gr_screen.clip_top )
96 if ( x1 < gr_screen.clip_left )
97 x1 = gr_screen.clip_left;
99 if ( x2 > gr_screen.clip_right )
100 x2 = gr_screen.clip_right;
102 if ( y1 < gr_screen.clip_top )
103 y1 = gr_screen.clip_top;
105 if ( y2 > gr_screen.clip_bottom )
106 y2 = gr_screen.clip_bottom;
119 if ( Current_alphacolor ) {
120 for (i=0; i<h; i++ ) {
121 dptr = GR_SCREEN_PTR(ubyte,x1,y1+i);
124 for( j=0; j<w; j++ ) {
125 *dptr++ = Current_alphacolor->table.lookup[14][*dptr];
130 for (i=0; i<h; i++ ) {
131 dptr = GR_SCREEN_PTR(ubyte,x1,y1+i);
132 memset( dptr, gr_screen.current_color.raw8, w );