summaryrefslogtreecommitdiff
path: root/libkmstest
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@iki.fi>2015-10-03 23:29:18 +0300
committerTomi Valkeinen <tomi.valkeinen@iki.fi>2015-10-04 10:21:56 +0300
commit8a991ee6b675d18739557e004ce993fa090ef0b5 (patch)
tree3ec4413fc64a6cc9bcaa3c6bd1467c18a166fad3 /libkmstest
parent2c0f9b2d85b71b916ef5c53d0b8c814167ae8525 (diff)
use PixelFormat all around
Diffstat (limited to 'libkmstest')
-rw-r--r--libkmstest/colorbar.cpp12
-rw-r--r--libkmstest/conv.cpp14
-rw-r--r--libkmstest/testpat.cpp10
3 files changed, 19 insertions, 17 deletions
diff --git a/libkmstest/colorbar.cpp b/libkmstest/colorbar.cpp
index bc9cdca..31a4510 100644
--- a/libkmstest/colorbar.cpp
+++ b/libkmstest/colorbar.cpp
@@ -102,23 +102,23 @@ static void drm_draw_color_bar_semiplanar_yuv(DumbFramebuffer& buf, int old_xpos
void draw_color_bar(DumbFramebuffer& buf, int old_xpos, int xpos, int width)
{
switch (buf.format()) {
- case DRM_FORMAT_NV12:
- case DRM_FORMAT_NV21:
+ case PixelFormat::NV12:
+ case PixelFormat::NV21:
// XXX not right but gets something on the screen
drm_draw_color_bar_semiplanar_yuv(buf, old_xpos, xpos, width);
break;
- case DRM_FORMAT_YUYV:
- case DRM_FORMAT_UYVY:
+ case PixelFormat::YUYV:
+ case PixelFormat::UYVY:
// XXX not right but gets something on the screen
drm_draw_color_bar_rgb565(buf, old_xpos, xpos, width);
break;
- case DRM_FORMAT_RGB565:
+ case PixelFormat::RGB565:
drm_draw_color_bar_rgb565(buf, old_xpos, xpos, width);
break;
- case DRM_FORMAT_XRGB8888:
+ case PixelFormat::XRGB8888:
drm_draw_color_bar_rgb888(buf, old_xpos, xpos, width);
break;
diff --git a/libkmstest/conv.cpp b/libkmstest/conv.cpp
index f2f19ac..45f4a75 100644
--- a/libkmstest/conv.cpp
+++ b/libkmstest/conv.cpp
@@ -34,13 +34,13 @@ static void fb_rgb_to_packed_yuv(DumbFramebuffer& dst_fb, const DumbFramebuffer&
YUV yuv2 = read_rgb_as_yuv(src_fb, x + 1, y);
switch (dst_fb.format()) {
- case DRM_FORMAT_UYVY:
+ case PixelFormat::UYVY:
dst[x * 2 + 0] = (yuv1.u + yuv2.u) / 2;
dst[x * 2 + 1] = yuv1.y;
dst[x * 2 + 2] = (yuv1.v + yuv2.v) / 2;
dst[x * 2 + 3] = yuv2.y;
break;
- case DRM_FORMAT_YUYV:
+ case PixelFormat::YUYV:
dst[x * 2 + 0] = yuv1.y;
dst[x * 2 + 1] = (yuv1.u + yuv2.u) / 2;
dst[x * 2 + 2] = yuv2.y;
@@ -116,17 +116,17 @@ static void fb_rgb_to_rgb565(DumbFramebuffer& dst_fb, const DumbFramebuffer& src
void color_convert(DumbFramebuffer& dst, const DumbFramebuffer &src)
{
switch (dst.format()) {
- case DRM_FORMAT_NV12:
- case DRM_FORMAT_NV21:
+ case PixelFormat::NV12:
+ case PixelFormat::NV21:
fb_rgb_to_semiplanar_yuv(dst, src);
break;
- case DRM_FORMAT_YUYV:
- case DRM_FORMAT_UYVY:
+ case PixelFormat::YUYV:
+ case PixelFormat::UYVY:
fb_rgb_to_packed_yuv(dst, src);
break;
- case DRM_FORMAT_RGB565:
+ case PixelFormat::RGB565:
fb_rgb_to_rgb565(dst, src);
break;
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");
}
}