diff --git a/common/common.h b/common/common.h index cc659b1..b05dd5e 100644 --- a/common/common.h +++ b/common/common.h @@ -82,17 +82,25 @@ static inline void DrawPixelRaw(uint32_t x, uint32_t y, color_t clr) if (x >= 1280 || y >= 720) return; u32 off = (y * g_framebuf_width + x)*4; - g_framebuf[off] = clr.r; off++; - g_framebuf[off] = clr.g; off++; - g_framebuf[off] = clr.b; off++; - g_framebuf[off] = 0xff; + *((u32*)&g_framebuf[off]) = clr.r | (clr.g<<8) | (clr.b<<16) | (0xff<<24); +} +static inline void Draw4PixelsRaw(uint32_t x, uint32_t y, color_t clr) +{ + if (x >= 1280 || y >= 720 || x > 1280-4) + return; + + u32 color = clr.r | (clr.g<<8) | (clr.b<<16) | (0xff<<24); + u128 val = color | ((u128)color<<32) | ((u128)color<<64) | ((u128)color<<96); + u32 off = (y * g_framebuf_width + x)*4; + *((u128*)&g_framebuf[off]) = val; } static inline color_t FetchPixelColor(uint32_t x, uint32_t y) { u32 off = (y * g_framebuf_width + x)*4; - u8 r = g_framebuf[off]; off++; - u8 g = g_framebuf[off]; off++; - u8 b = g_framebuf[off]; + u32 val = *((u32*)&g_framebuf[off]); + u8 r = (u8)val; + u8 g = (u8)(val>>8); + u8 b = (u8)(val>>16); return MakeColor(r, g, b, 255); } #else @@ -115,6 +123,11 @@ static inline void DrawPixelRaw(uint32_t x, uint32_t y, color_t clr) pixels[y][x].b = clr.b; pixels[y][x].a = 0xff; } +static inline void Draw4PixelsRaw(uint32_t x, uint32_t y, color_t clr) +{ + uint32_t pos; + for (pos=0; pos<4; pos++) DrawPixelRaw(x+pos, y, clr); +} static inline color_t FetchPixelColor(uint32_t x, uint32_t y) { return pixels[y][x]; diff --git a/common/menu.c b/common/menu.c index 5b32c99..92e04b7 100644 --- a/common/menu.c +++ b/common/menu.c @@ -55,6 +55,7 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) { int end_y = start_y + 140 + 32; int start_x = off_x;//(n / 2); int end_x = start_x + 140; + int j; const uint8_t *smallimg = NULL; const uint8_t *largeimg = NULL; @@ -87,23 +88,22 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) { } //{ - for (x=border_start_x; x= border_start_x + shadow_inset && x < border_end_x - shadow_inset) { - DrawPixel(x, end_y +shadow_y, shadow_color); + for (j=0; j<4; j++) DrawPixel(x+j, end_y +shadow_y, shadow_color); } } } @@ -140,9 +140,9 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) { } //} - for (x=start_x; x