diff --git a/src/effect.c b/src/effect.c index 9804ce6..847b548 100644 --- a/src/effect.c +++ b/src/effect.c @@ -217,6 +217,21 @@ static void effect_oscillate(float rate) gfx_copy(dst, delta_x, delta_y, &effect.new, 0, 0, dst->w, dst->h); } +static void effect_tv_switch_off(float rate) +{ + Texture *dst = gfx_main_surface(); + if (rate < 0.5f) { + int h = max(1, (int)(dst->h * (1.0f - rate * 2.0f))); + gfx_copy_stretch(dst, 0, dst->h * rate, dst->w, h, + &effect.old, 0, 0, effect.old.w, effect.old.h); + } else { + rate -= 0.5f; + int w = dst->w * (1.0f - rate * 2.0f); + gfx_copy_stretch(dst, dst->w * rate, dst->h / 2, w, 1, + &effect.old, 0, 0, effect.old.w, effect.old.h); + } +} + static void effect_zoom_in_crossfade(float rate) { Texture *dst = gfx_main_surface(); @@ -238,6 +253,7 @@ static effect_fun effect_functions[NR_EFFECTS] = { [EFFECT_WHITEOUT] = effect_whiteout, [EFFECT_WHITEIN] = effect_whitein, [EFFECT_OSCILLATE] = effect_oscillate, + [EFFECT_TV_SWITCH_OFF] = effect_tv_switch_off, [EFFECT_ZOOM_LR] = effect_zoom_lr, [EFFECT_ZOOM_RL] = effect_zoom_rl, [EFFECT_ZOOM_IN_CROSSFADE] = effect_zoom_in_crossfade,