We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8cbfb5c commit 0e95069Copy full SHA for 0e95069
libvisual/libvisual/private/lv_video_blit.cpp
@@ -78,6 +78,9 @@ namespace LV {
78
for (int x = 0; x < src->m_impl->width; x++) {
79
uint8_t const src_alpha = src_pixel[3];
80
81
+ // NOTE: This is effectively
82
+ // "(src_alpha / 255) * src_pixel[i] + (1 - src_alpha / 255) * dst_pixel[i]"
83
+ // but with only a single multiplication, a single division by 256 rather than 255, for speed.
84
dst_pixel[0] = (src_alpha * (src_pixel[0] - dst_pixel[0]) >> 8) + dst_pixel[0];
85
dst_pixel[1] = (src_alpha * (src_pixel[1] - dst_pixel[1]) >> 8) + dst_pixel[1];
86
dst_pixel[2] = (src_alpha * (src_pixel[2] - dst_pixel[2]) >> 8) + dst_pixel[2];
0 commit comments