1
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-11-22 09:16:19 +00:00
Lakka-LibreELEC/packages/tools/plymouth-lite/patches/plymouth-lite-0.6.0-21-16bpp.patch

79 lines
2.4 KiB
Diff

--- plymouth-lite-0.6.0/ply-frame-buffer.c 2015-07-02 01:04:37.625076373 +0100
+++ plymouth-lite-0.6.0.patch/ply-frame-buffer.c 2015-07-02 01:04:42.973076293 +0100
@@ -184,6 +184,58 @@
}
}
+static void
+flush_xbgr32 (ply_frame_buffer_t *buffer)
+{
+ unsigned long x1, y1, x2, y2, x, y;
+ char *dst, *src;
+
+ x1 = buffer->area_to_flush.x;
+ y1 = buffer->area_to_flush.y;
+ x2 = x1 + buffer->area_to_flush.width;
+ y2 = y1 + buffer->area_to_flush.height;
+
+ for (y = y1; y < y2; y++)
+ {
+ dst = &buffer->map_address[(y * buffer->row_stride + x1) * 4];
+ src = (char *) &buffer->shadow_buffer[y * buffer->area.width + x1];
+
+ for (x = x1; x < x2; x++)
+ {
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
+ dst[3] = src[3];
+ dst += 4;
+ src += 4;
+ }
+ }
+}
+
+static void
+flush_rgb16 (ply_frame_buffer_t *buffer)
+{
+ unsigned long x1, y1, x2, y2, x, y;
+ unsigned short *dst; unsigned char *src;
+
+ x1 = buffer->area_to_flush.x;
+ y1 = buffer->area_to_flush.y;
+ x2 = x1 + buffer->area_to_flush.width;
+ y2 = y1 + buffer->area_to_flush.height;
+
+ for (y = y1; y < y2; y++)
+ {
+ dst = (unsigned short *)&buffer->map_address[(y * buffer->row_stride + x1) * 2];
+ src = (unsigned char *) &buffer->shadow_buffer[y * buffer->area.width + x1];
+
+ for (x = x1; x < x2; x++)
+ {
+ *dst++ = (src[0]>>3) << 0 | (src[1]>>2) << 5 | (src[2]>>3) << 11;
+ src += 4;
+ }
+ }
+}
+
static const char const *p_visual(int visual)
{
static const char const *visuals[] =
@@ -300,6 +352,16 @@
buffer->green_bit_position == 8 && buffer->bits_for_green == 8 &&
buffer->blue_bit_position == 0 && buffer->bits_for_blue == 8)
buffer->flush = flush_xrgb32;
+ else if (buffer->bytes_per_pixel == 4 &&
+ buffer->red_bit_position == 0 && buffer->bits_for_red == 8 &&
+ buffer->green_bit_position == 8 && buffer->bits_for_green == 8 &&
+ buffer->blue_bit_position == 16 && buffer->bits_for_blue == 8)
+ buffer->flush = flush_xbgr32;
+ else if (buffer->bytes_per_pixel == 2 &&
+ buffer->red_bit_position == 11 && buffer->bits_for_red == 5 &&
+ buffer->green_bit_position == 5 && buffer->bits_for_green == 6 &&
+ buffer->blue_bit_position == 0 && buffer->bits_for_blue == 5)
+ buffer->flush = flush_rgb16;
else
buffer->flush = flush_generic;