2006-03-20 16:43:15 +00:00
|
|
|
/*
|
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
2013-02-24 02:39:48 +00:00
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
2006-03-20 16:43:15 +00:00
|
|
|
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
2009-11-30 22:42:55 +00:00
|
|
|
|
2006-03-20 16:43:15 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Graphical routines for drawing solid scanlines.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "u_mem.h"
|
|
|
|
#include "gr.h"
|
|
|
|
#include "grdef.h"
|
2012-07-07 18:35:06 +00:00
|
|
|
#include "dxxerror.h"
|
2006-03-20 16:43:15 +00:00
|
|
|
|
|
|
|
void gr_linear_darken(ubyte * dest, int darkening_level, int count, ubyte * fade_table) {
|
|
|
|
register int i;
|
|
|
|
|
2009-11-30 22:42:55 +00:00
|
|
|
for (i=0;i<count;i++)
|
|
|
|
{
|
|
|
|
*dest = fade_table[(*dest)+(darkening_level*256)];
|
2006-03-20 16:43:15 +00:00
|
|
|
dest++;
|
|
|
|
}
|
|
|
|
}
|
2009-11-30 22:42:55 +00:00
|
|
|
|
|
|
|
void gr_linear_stosd( ubyte * dest, unsigned char color, unsigned int nbytes) {
|
|
|
|
memset(dest,color,nbytes);
|
|
|
|
}
|
2006-03-20 16:43:15 +00:00
|
|
|
|
|
|
|
void gr_uscanline( int x1, int x2, int y )
|
|
|
|
{
|
2011-02-23 16:46:36 +00:00
|
|
|
if (grd_curcanv->cv_fade_level >= GR_FADE_OFF) {
|
2006-03-20 16:43:15 +00:00
|
|
|
switch(TYPE)
|
|
|
|
{
|
|
|
|
case BM_LINEAR:
|
2009-11-30 22:42:55 +00:00
|
|
|
#ifdef OGL
|
|
|
|
case BM_OGL:
|
2006-03-20 16:43:15 +00:00
|
|
|
#endif
|
|
|
|
gr_linear_stosd( DATA + ROWSIZE*y + x1, (unsigned char)COLOR, x2-x1+1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch(TYPE)
|
|
|
|
{
|
|
|
|
case BM_LINEAR:
|
2009-11-30 22:42:55 +00:00
|
|
|
#ifdef OGL
|
|
|
|
case BM_OGL:
|
2006-03-20 16:43:15 +00:00
|
|
|
#endif
|
2011-02-23 16:46:36 +00:00
|
|
|
gr_linear_darken( DATA + ROWSIZE*y + x1, grd_curcanv->cv_fade_level, x2-x1+1, gr_fade_table);
|
2006-03-20 16:43:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void gr_scanline( int x1, int x2, int y )
|
|
|
|
{
|
|
|
|
if ((y<0)||(y>MAXY)) return;
|
|
|
|
|
|
|
|
if (x2 < x1 ) x2 ^= x1 ^= x2;
|
|
|
|
|
|
|
|
if (x1 > MAXX) return;
|
|
|
|
if (x2 < MINX) return;
|
|
|
|
|
|
|
|
if (x1 < MINX) x1 = MINX;
|
|
|
|
if (x2 > MAXX) x2 = MAXX;
|
|
|
|
|
2011-02-23 16:46:36 +00:00
|
|
|
if (grd_curcanv->cv_fade_level >= GR_FADE_OFF) {
|
2006-03-20 16:43:15 +00:00
|
|
|
switch(TYPE)
|
|
|
|
{
|
|
|
|
case BM_LINEAR:
|
2009-11-30 22:42:55 +00:00
|
|
|
#ifdef OGL
|
|
|
|
case BM_OGL:
|
2006-03-20 16:43:15 +00:00
|
|
|
#endif
|
|
|
|
gr_linear_stosd( DATA + ROWSIZE*y + x1, (unsigned char)COLOR, x2-x1+1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch(TYPE)
|
|
|
|
{
|
|
|
|
case BM_LINEAR:
|
2009-11-30 22:42:55 +00:00
|
|
|
#ifdef OGL
|
|
|
|
case BM_OGL:
|
2006-03-20 16:43:15 +00:00
|
|
|
#endif
|
2011-02-23 16:46:36 +00:00
|
|
|
gr_linear_darken( DATA + ROWSIZE*y + x1, grd_curcanv->cv_fade_level, x2-x1+1, gr_fade_table);
|
2006-03-20 16:43:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|