================ R_Dropsample Used to resample images in a more general than quartering fashion. Normal maps and such should not be bilerped. ================ */
| 107 | ================ |
| 108 | */ |
| 109 | byte *R_Dropsample( const byte *in, int inwidth, int inheight, |
| 110 | int outwidth, int outheight ) { |
| 111 | int i, j, k; |
| 112 | const byte *inrow; |
| 113 | const byte *pix1; |
| 114 | byte *out, *out_p; |
| 115 | |
| 116 | out = (byte *)R_StaticAlloc( outwidth * outheight * 4 ); |
| 117 | out_p = out; |
| 118 | |
| 119 | for (i=0 ; i<outheight ; i++, out_p += outwidth*4 ) { |
| 120 | inrow = in + 4*inwidth*(int)((i+0.25)*inheight/outheight); |
| 121 | for (j=0 ; j<outwidth ; j++) { |
| 122 | k = j * inwidth / outwidth; |
| 123 | pix1 = inrow + k * 4; |
| 124 | out_p[j*4+0] = pix1[0]; |
| 125 | out_p[j*4+1] = pix1[1]; |
| 126 | out_p[j*4+2] = pix1[2]; |
| 127 | out_p[j*4+3] = pix1[3]; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | return out; |
| 132 | } |
| 133 | |
| 134 | |
| 135 | /* |
no test coverage detected