MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / BlurBitmapArea

Function BlurBitmapArea

Descent3/TelcomEffectsRender.cpp:414–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412 tce->age += frametime;
413}
414void BlurBitmapArea(uint16_t *srcbm, uint16_t *dstbm, int16_t width, int16_t height, int16_t startx, int16_t starty, int16_t bmw) {
415 int pixel_count, blue_total, red_total, green_total;
416 pixel_count = width * height;
417 blue_total = red_total = green_total = 0;
418 int16_t x, y;
419 int16_t pos;
420 if (!pixel_count)
421 return;
422
423 for (y = starty; y < height + starty; y++)
424 for (x = startx; x < width + startx; x++) {
425 pos = y * bmw + x;
426 if (srcbm[pos] & OPAQUE_FLAG) {
427 blue_total += GR_COLOR_BLUE(GR_16_TO_COLOR(srcbm[pos]));
428 red_total += GR_COLOR_RED(GR_16_TO_COLOR(srcbm[pos]));
429 green_total += GR_COLOR_GREEN(GR_16_TO_COLOR(srcbm[pos]));
430 }
431 }
432 uint16_t col;
433 if (red_total + green_total + blue_total)
434 col = OPAQUE_FLAG | GR_RGB16(red_total / pixel_count, green_total / pixel_count, blue_total / pixel_count);
435 else
436 col = 0;
437 for (x = startx; x < width + startx; x++)
438 for (y = starty; y < height + starty; y++) {
439 dstbm[y * bmw + x] = col;
440 }
441}
442void RenderBmpBlur(tceffect *tce, float frametime, int xoff, int yoff, bool ok_to_render) {
443 ASSERT(tce->type == EFX_BMP_BLUR);
444 if (!ok_to_render) {

Callers 1

RenderBmpBlurFunction · 0.85

Calls 5

GR_COLOR_BLUEFunction · 0.85
GR_16_TO_COLORFunction · 0.85
GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_RGB16Function · 0.85

Tested by

no test coverage detected