Skip to content

Commit

Permalink
[effect] Switch "Timescope" to use blend.h
Browse files Browse the repository at this point in the history
  • Loading branch information
grandchild committed Oct 26, 2024
1 parent eb6da79 commit 8ab0eff
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions avs/vis_avs/e_timescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "e_timescope.h"

#include "r_defs.h"
#include "blend.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -73,7 +73,7 @@ int E_Timescope::render(char visdata[2][2][576],

this->position++;
this->position %= w;
framebuffer += this->position;
auto fb = (uint32_t*)framebuffer + this->position;
uint32_t r, g, b;
r = (uint32_t)this->config.color & 0xff;
g = ((uint32_t)this->config.color >> 8) & 0xff;
Expand All @@ -84,16 +84,12 @@ int E_Timescope::render(char visdata[2][2][576],
px = (r * px) / 256 + (((g * px) / 256) << 8) + (((b * px) / 256) << 16);
switch (this->config.blend_mode) {
default:
case TIMESCOPE_BLEND_DEFAULT: BLEND_LINE(framebuffer, px); break;
case TIMESCOPE_BLEND_ADDITIVE:
framebuffer[0] = BLEND(framebuffer[0], px);
break;
case TIMESCOPE_BLEND_5050:
framebuffer[0] = BLEND_AVG(framebuffer[0], px);
break;
case TIMESCOPE_BLEND_REPLACE: framebuffer[0] = px;
case TIMESCOPE_BLEND_DEFAULT: blend_default_1px(&px, fb, fb); break;
case TIMESCOPE_BLEND_ADDITIVE: blend_add_1px(&px, fb, fb); break;
case TIMESCOPE_BLEND_5050: blend_5050_1px(&px, fb, fb); break;
case TIMESCOPE_BLEND_REPLACE: blend_replace_1px(&px, fb); break;
}
framebuffer += w;
fb += w;
}

return 0;
Expand Down

0 comments on commit 8ab0eff

Please sign in to comment.