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

Function R_ImageAdd

neo/renderer/Image_program.cpp:303–330  ·  view source on GitHub ↗

=================== R_ImageAdd =================== */

Source from the content-addressed store, hash-verified

301===================
302*/
303static void R_ImageAdd( byte *data1, int width1, int height1, byte *data2, int width2, int height2 ) {
304 int i, j;
305 int c;
306 byte *newMap;
307
308 // resample pic2 to the same size as pic1
309 if ( width2 != width1 || height2 != height1 ) {
310 newMap = R_Dropsample( data2, width2, height2, width1, height1 );
311 data2 = newMap;
312 } else {
313 newMap = NULL;
314 }
315
316
317 c = width1 * height1 * 4;
318
319 for ( i = 0 ; i < c ; i++ ) {
320 j = data1[i] + data2[i];
321 if ( j > 255 ) {
322 j = 255;
323 }
324 data1[i] = j;
325 }
326
327 if ( newMap ) {
328 R_StaticFree( newMap );
329 }
330}
331
332
333// we build a canonical token form of the image program here

Callers 1

R_ParseImageProgram_rFunction · 0.85

Calls 2

R_DropsampleFunction · 0.85
R_StaticFreeFunction · 0.85

Tested by

no test coverage detected