diff options
author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-03 23:29:18 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-04 10:21:56 +0300 |
commit | 8a991ee6b675d18739557e004ce993fa090ef0b5 (patch) | |
tree | 3ec4413fc64a6cc9bcaa3c6bd1467c18a166fad3 /libkmstest/testpat.cpp | |
parent | 2c0f9b2d85b71b916ef5c53d0b8c814167ae8525 (diff) |
use PixelFormat all around
Diffstat (limited to 'libkmstest/testpat.cpp')
-rw-r--r-- | libkmstest/testpat.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libkmstest/testpat.cpp b/libkmstest/testpat.cpp index 1516369..c8188d8 100644 --- a/libkmstest/testpat.cpp +++ b/libkmstest/testpat.cpp @@ -21,19 +21,19 @@ static void draw_pixel(DumbFramebuffer& buf, unsigned x, unsigned y, RGB color) static RGB c1; switch (buf.format()) { - case DRM_FORMAT_XRGB8888: + case PixelFormat::XRGB8888: { uint32_t *p = (uint32_t*)(buf.map(0) + buf.stride(0) * y + x * 4); *p = color.raw; break; } - case DRM_FORMAT_RGB565: + case PixelFormat::RGB565: { uint16_t *p = (uint16_t*)(buf.map(0) + buf.stride(0) * y + x * 2); *p = color.rgb565(); break; } - case DRM_FORMAT_UYVY: + case PixelFormat::UYVY: { if ((x & 1) == 0) { c1 = color; @@ -51,7 +51,7 @@ static void draw_pixel(DumbFramebuffer& buf, unsigned x, unsigned y, RGB color) p[3] = yuv2.y; break; } - case DRM_FORMAT_YUYV: + case PixelFormat::YUYV: { if ((x & 1) == 0) { c1 = color; @@ -69,6 +69,8 @@ static void draw_pixel(DumbFramebuffer& buf, unsigned x, unsigned y, RGB color) p[3] = (yuv1.v + yuv2.v) / 2; break; } + default: + throw std::invalid_argument("unknown pixelformat"); } } |