diff --git a/src/video/glhudmodel.c b/src/video/glhudmodel.c index 267a9beb..a220baaa 100644 --- a/src/video/glhudmodel.c +++ b/src/video/glhudmodel.c @@ -35,8 +35,9 @@ void glhud_setupDefault(GLModel *parent) { const unsigned int fb_w = hudElement->pixWidth; const unsigned int fb_h = hudElement->pixHeight; const unsigned int count = fb_w * fb_h; - for (unsigned int i=0, j=0; itexPixels + j) ) = rgb; + *( (uint32_t*)(parent->texPixels + dstIdx) ) = rgb; } + + // RGBA_8888 second pass to generate halo effect + if (hudElement->opaquePixelHalo) { + for (unsigned int + srcIdx=0, dstPre=-((fb_w+1)*4), dstIdx=0, dstPost=((fb_w-1)*4); + srcIdx= 0) { // north pixels + if (col != 0) { + *((uint32_t*)(parent->texPixels + dstPre)) |= RGB_MASK; + } + *((uint32_t*)(parent->texPixels + dstPre + 4)) |= RGB_MASK; + if (col < fb_w-1) { + *((uint32_t*)(parent->texPixels + dstPre + 8)) |= RGB_MASK; + } + } + + if (col != 0) { // west pixel + *((uint32_t*)(parent->texPixels + dstIdx - 4)) |= RGB_MASK; + } + + if (col < fb_w-1) { // east pixel + *((uint32_t*)(parent->texPixels + dstIdx + 4)) |= RGB_MASK; + } + + if (dstPost < count8888) { // south pixels + if (col != 0) { + *((uint32_t*)(parent->texPixels + dstPost)) |= RGB_MASK; + } + *((uint32_t*)(parent->texPixels + dstPost + 4)) |= RGB_MASK; + if (col < fb_w-1) { + *((uint32_t*)(parent->texPixels + dstPost + 8)) |= RGB_MASK; + } + } + } + } + parent->texDirty = true; } diff --git a/src/video/glhudmodel.h b/src/video/glhudmodel.h index 39063305..6827e7b1 100644 --- a/src/video/glhudmodel.h +++ b/src/video/glhudmodel.h @@ -27,6 +27,7 @@ \ interface_colorscheme_t colorScheme; \ bool blackIsTransparent; \ + bool opaquePixelHalo; \ \ __VA_ARGS__ \ ) diff --git a/src/video/gltouchkbd.c b/src/video/gltouchkbd.c index f2890fb4..1c3fcee9 100644 --- a/src/video/gltouchkbd.c +++ b/src/video/gltouchkbd.c @@ -475,6 +475,7 @@ static void *_create_touchkbd_hud(void) { GLModelHUDKeyboard *hudKeyboard = (GLModelHUDKeyboard *)calloc(sizeof(GLModelHUDKeyboard), 1); if (hudKeyboard) { hudKeyboard->blackIsTransparent = true; + hudKeyboard->opaquePixelHalo = true; } return hudKeyboard; } diff --git a/src/video/gltouchmenu.c b/src/video/gltouchmenu.c index 19e9bdc2..8c7eefb7 100644 --- a/src/video/gltouchmenu.c +++ b/src/video/gltouchmenu.c @@ -444,6 +444,7 @@ static void *_create_touchmenu(void) { GLModelHUDMenu *hudMenu = (GLModelHUDMenu *)calloc(sizeof(GLModelHUDMenu), 1); if (hudMenu) { hudMenu->blackIsTransparent = true; + hudMenu->opaquePixelHalo = true; } return hudMenu; }