MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / R_Dropsample

Function R_Dropsample

neo/renderer/Image_process.cpp:109–132  ·  view source on GitHub ↗

================ R_Dropsample Used to resample images in a more general than quartering fashion. Normal maps and such should not be bilerped. ================ */

Source from the content-addressed store, hash-verified

107================
108*/
109byte *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/*

Callers 2

R_AddNormalMapsFunction · 0.85
R_ImageAddFunction · 0.85

Calls 1

R_StaticAllocFunction · 0.85

Tested by

no test coverage detected