=================== R_ImageAdd =================== */
| 301 | =================== |
| 302 | */ |
| 303 | static 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 |
no test coverage detected