Revision 24 featured cleaner code, but a pointer bug was also in the same bag.

Also, I tried to solve the blur problem, changing setImage and getImage, but that downgraded (IMHO) blurring.

So... we have the same blurring problems (as of revision 22), but cleaner code.

git-svn-id: https://svn.code.sf.net/p/q3cellshading/code/trunk@25 db09e94b-7117-0410-a7e6-85ae5ff6e0e9
This commit is contained in:
gmiranda 2006-07-28 11:47:38 +00:00
parent f378cc2a2d
commit 76b1e0f621

View file

@ -1134,14 +1134,12 @@ byte getImageR(byte *targa_rgba, int x, int y, int columns, int rows)
{
byte *pixbuf;
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return 0;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
pixbuf = targa_rgba + y*columns*4;
if(columns<x)
x=x%columns;
@ -1157,10 +1155,8 @@ void setImageR(byte *targa_rgba, int x, int y, int columns, int rows, byte value
{
byte *pixbuf;
/*x*=((x<0)?-1:1);
y*=((y<0)?-1:1);*/
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
pixbuf = targa_rgba + y*columns*4;
@ -1174,9 +1170,6 @@ byte getImageG(byte *targa_rgba, int x, int y, int columns, int rows)
{
byte *pixbuf;
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return 0;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
@ -1198,10 +1191,8 @@ void setImageG(byte *targa_rgba, int x, int y, int columns, int rows, byte value
{
byte *pixbuf;
/*x*=((x<0)?-1:1);
y*=((y<0)?-1:1);*/
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
pixbuf = targa_rgba + y*columns*4;
@ -1214,9 +1205,6 @@ byte getImageB(byte *targa_rgba, int x, int y, int columns, int rows)
{
byte *pixbuf;
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return 0;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
@ -1237,10 +1225,8 @@ void setImageB(byte *targa_rgba, int x, int y, int columns, int rows, byte value
{
byte *pixbuf;
/*x*=((x<0)?-1:1);
y*=((y<0)?-1:1);*/
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
pixbuf = targa_rgba + y*columns*4;
@ -1253,10 +1239,8 @@ byte getImageA(byte *targa_rgba, int x, int y, int columns, int rows)
{
byte *pixbuf;
/*x*=((x<0)?-1:1);
y*=((y<0)?-1:1);*/
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return 0;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
pixbuf = targa_rgba + y*columns*4;
@ -1269,10 +1253,8 @@ void setImageA(byte *targa_rgba, int x, int y, int columns, int rows, byte value
{
byte *pixbuf;
/*x*=((x<0)?-1:1);
y*=((y<0)?-1:1);*/
if((x<0)||(x>=columns)||(y<0)||(y>rows))
return;
x*=((x<0)?-1:1);
y*=((y<0)?-1:1);
pixbuf = targa_rgba + y*columns*4;
@ -1454,9 +1436,6 @@ static void LoadBMP( const char *name, byte **pic, int *width, int *height )
}
}
}
ri.FS_FreeFile( buffer );
}
@ -1846,7 +1825,6 @@ static void LoadTGA ( const char *name, byte **pic, int *width, int *height)
}
}
#if 0
// TTimo: this is the chunk of code to ensure a behavior that meets TGA specs
// bk0101024 - fix from Leonardo
@ -2359,10 +2337,11 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height ) {
} else if ( !Q_stricmp( name+len-4, ".jpg" ) ) {
LoadJPG( name, pic, width, height );
}
if(r_celshadalgo->integer==1)
kuwahara(*width,*height,pic);
kuwahara(*width,*height,*pic);
else if(r_celshadalgo->integer==2)
whiteTexture(*width,*height,pic);
whiteTexture(*width,*height,*pic);
}