Skip to content

Commit

Permalink
FEATURE_VRAM_RGBA: Draw full buffer while displaying LV overlays
Browse files Browse the repository at this point in the history
  • Loading branch information
kitor committed Nov 5, 2021
1 parent d4895d4 commit 94c0e03
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "compositor.h"
#include <stdarg.h>
#include "propvalues.h"
#include "zebra.h"

//~ int bmp_enabled = 1;

Expand Down Expand Up @@ -196,17 +197,26 @@ void refresh_yuv_from_rgb(void)
}

//SJE FIXME benchmark this loop, it probably wants optimising
for (size_t n = 0; n < BMP_VRAM_SIZE; n++)
{
// limited alpha support, if dest pixel would be full alpha,
// don't copy into dest. This is COLOR_TRANSPARENT_BLACK in
// the LUT
uint32_t rgb = indexed2rgb(*b);
if ((rgb && 0xff000000) == 0x00000000)
rgb_data++;
else
*rgb_data++ = rgb;
b++;
if(zebra_should_run()){
// always draw our stuff, including full alpha
for (size_t n = 0; n < BMP_VRAM_SIZE; n++){
*rgb_data++ = indexed2rgb(*b);
b++;
}
}
else{

This comment has been minimized.

Copy link
@kitor

kitor Nov 13, 2021

Author Contributor

Reason is - our limited "alpha" support is just "don't draw pixel X if it has alpha value set".

In LV overlays we clear widget backgrounds with 100% transparent one, before redraw (as widgets have transparent bg). Using regular code will not clear background before redraw, thus rendering widgets broken.

for (size_t n = 0; n < BMP_VRAM_SIZE; n++)
{
// limited alpha support, if dest pixel would be full alpha,
// don't copy into dest. This is COLOR_TRANSPARENT_BLACK in
// the LUT
uint32_t rgb = indexed2rgb(*b);
if ((rgb && 0xff000000) == 0x00000000)
rgb_data++;
else
*rgb_data++ = rgb;
b++;
}
}

// trigger Ximr to render to OSD from RGB buffer
Expand Down

0 comments on commit 94c0e03

Please sign in to comment.