Linux Port (GTK): Remove and replace legacy colorspace handling routines with the new SIMD-optimized colorspace handling routines.

This commit is contained in:
rogerman 2017-11-22 17:43:17 -08:00
parent 96bd35517b
commit b9ada994df
1 changed files with 2 additions and 47 deletions

View File

@ -1524,54 +1524,9 @@ static int ConfigureDrawingArea(GtkWidget *widget, GdkEventConfigure *event, gpo
return TRUE;
}
// Adapted from Cocoa port
static const uint8_t bits5to8[] = {
0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3A,
0x42, 0x4A, 0x52, 0x5A, 0x63, 0x6B, 0x73, 0x7B,
0x84, 0x8C, 0x94, 0x9C, 0xA5, 0xAD, 0xB5, 0xBD,
0xC5, 0xCE, 0xD6, 0xDE, 0xE6, 0xEF, 0xF7, 0xFF
};
static inline uint32_t RGB555ToRGBA8888(const uint16_t color16)
{
return (bits5to8[((color16 >> 0) & 0x001F)] << 0) |
(bits5to8[((color16 >> 5) & 0x001F)] << 8) |
(bits5to8[((color16 >> 10) & 0x001F)] << 16) |
0xFF000000;
}
static inline uint32_t RGB555ToBGRA8888(const uint16_t color16)
{
return (bits5to8[((color16 >> 10) & 0x001F)] << 0) |
(bits5to8[((color16 >> 5) & 0x001F)] << 8) |
(bits5to8[((color16 >> 0) & 0x001F)] << 16) |
0xFF000000;
}
// Adapted from Cocoa port
static inline void RGB555ToRGBA8888Buffer(const uint16_t *__restrict__ srcBuffer, uint32_t *__restrict__ destBuffer, size_t pixelCount)
{
const uint32_t *__restrict__ destBufferEnd = destBuffer + pixelCount;
while (destBuffer < destBufferEnd)
{
*destBuffer++ = RGB555ToRGBA8888(*srcBuffer++);
}
}
static inline void RGB555ToBGRA8888Buffer(const uint16_t *__restrict__ srcBuffer, uint32_t *__restrict__ destBuffer, size_t pixelCount)
{
const uint32_t *__restrict__ destBufferEnd = destBuffer + pixelCount;
while (destBuffer < destBufferEnd)
{
*destBuffer++ = RGB555ToBGRA8888(*srcBuffer++);
}
}
static inline void gpu_screen_to_rgb(u32* dst)
{
RGB555ToRGBA8888Buffer((const uint16_t *)GPU->GetDisplayInfo().masterNativeBuffer, dst, 256 * 384);
ColorspaceConvertBuffer555To8888Opaque<false, false>((const uint16_t *)GPU->GetDisplayInfo().masterNativeBuffer, dst, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2);
}
static inline void drawScreen(cairo_t* cr, u32* buf, gint w, gint h) {
@ -1696,7 +1651,7 @@ static gboolean ExposeDrawingArea (GtkWidget *widget, GdkEventExpose *event, gpo
}
static void RedrawScreen() {
RGB555ToBGRA8888Buffer((const uint16_t *)GPU->GetDisplayInfo().masterNativeBuffer, video->GetSrcBufferPtr(), 256 * 384);
ColorspaceConvertBuffer555To8888Opaque<true, false>((const uint16_t *)GPU->GetDisplayInfo().masterNativeBuffer, (uint32_t *)video->GetSrcBufferPtr(), GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2);
#ifdef HAVE_LIBAGG
aggDraw.hud->attach((u8*)video->GetSrcBufferPtr(), 256, 384, 1024);
osd->update();