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

Function RenderBmpBlur

Descent3/TelcomEffectsRender.cpp:442–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {
445 if (tce->flags == TC_BMPF_OUT && (!(tce->flags & TC_NOEARLYRENDER))) {
446 UploadChunk(&tce->bmpinfo.chunk_bmp);
447 BltBmpToScreen(tce->pos_x + glitch_dx + xoff, tce->pos_y + glitch_dy + yoff, &tce->bmpinfo.chunk_bmp);
448 }
449 return;
450 }
451
452 if ((tce->flags == TC_BMPF_OUT) && (tce->bmpinfo.stage <= 0))
453 return;
454 int sbm_handle = tce->bmpinfo.bm_handle;
455 int dbm_handle = tce->bmpinfo.temp_bmhandle;
456 bm_ClearBitmap(dbm_handle);
457 int x = 0;
458 int y = 0;
459 bool done = false;
460 if ((tce->flags == TC_BMPF_OUT) && (tce->bmpinfo.stage < 0))
461 done = true;
462 if ((tce->flags == TC_BMPF_IN) && (tce->bmpinfo.stage > BLUR_STAGES))
463 done = true;
464
465 uint16_t *src, *dest;
466 int rowsize, w, h;
467
468 if (!done) {
469 src = bm_data(sbm_handle, 0);
470 dest = bm_data(dbm_handle, 0);
471 rowsize = bm_w(sbm_handle, 0);
472 w = bm_w(sbm_handle, 0);
473 h = bm_h(sbm_handle, 0);
474 int current_stage;
475 int block_size;
476 current_stage = tce->bmpinfo.stage;
477 block_size = 1 << (BLUR_STAGES - current_stage);
478 int x = 0, y = 0, bs_w, bs_h;
479
480 for (x = 0; x < w; x += block_size)
481 for (y = 0; y < h; y += block_size) {
482 if (x + block_size > w)
483 bs_w = w - x;
484 else
485 bs_w = block_size;
486 if (y + block_size > h)
487 bs_h = h - y;
488 else
489 bs_h = block_size;
490 BlurBitmapArea(src, dest, bs_w, bs_h, x, y, w);
491 }
492 int dim = bm_w(tce->bmpinfo.chunk_bmp.bm_array[0], 0);
493 int how_many_across = tce->bmpinfo.chunk_bmp.w;
494 int bh = tce->bmpinfo.chunk_bmp.ph;
495 int bw = tce->bmpinfo.chunk_bmp.pw;
496 uint16_t *src_data = bm_data(dbm_handle, 0);
497 for (y = 0; y < bh; y++) {
498 for (x = 0; x < bw; x++) {
499 int piece_y = y / dim;

Callers 1

RenderEffectFunction · 0.85

Calls 7

UploadChunkFunction · 0.85
BltBmpToScreenFunction · 0.85
bm_ClearBitmapFunction · 0.85
bm_dataFunction · 0.85
bm_wFunction · 0.85
bm_hFunction · 0.85
BlurBitmapAreaFunction · 0.85

Tested by

no test coverage detected