diff options
Diffstat (limited to 'libkmstest')
-rw-r--r-- | libkmstest/color.cpp | 9 | ||||
-rw-r--r-- | libkmstest/testpat.cpp | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/libkmstest/color.cpp b/libkmstest/color.cpp index 4d4a741..78012ac 100644 --- a/libkmstest/color.cpp +++ b/libkmstest/color.cpp @@ -4,7 +4,8 @@ namespace kms { RGB::RGB() { - r = g = b = a = 0; + r = g = b = 0; + a = 255; } RGB::RGB(uint8_t r, uint8_t g, uint8_t b) @@ -12,17 +13,17 @@ RGB::RGB(uint8_t r, uint8_t g, uint8_t b) this->r = r; this->g = g; this->b = b; - this->a = 0; + this->a = 255; } uint32_t RGB::rgb888() const { - return (r << 16) | (g << 8) | (b << 0); + return (a << 24) | (r << 16) | (g << 8) | (b << 0); } uint32_t RGB::bgr888() const { - return (b << 16) | (g << 8) | (r << 0); + return (a << 24) | (b << 16) | (g << 8) | (r << 0); } uint16_t RGB::rgb565() const diff --git a/libkmstest/testpat.cpp b/libkmstest/testpat.cpp index 1618855..b054cf6 100644 --- a/libkmstest/testpat.cpp +++ b/libkmstest/testpat.cpp @@ -20,12 +20,14 @@ static void draw_rgb_pixel(DumbFramebuffer& buf, unsigned x, unsigned y, RGB col { switch (buf.format()) { case PixelFormat::XRGB8888: + case PixelFormat::ARGB8888: { uint32_t *p = (uint32_t*)(buf.map(0) + buf.stride(0) * y + x * 4); *p = color.rgb888(); break; } case PixelFormat::XBGR8888: + case PixelFormat::ABGR8888: { uint32_t *p = (uint32_t*)(buf.map(0) + buf.stride(0) * y + x * 4); *p = color.bgr888(); @@ -219,6 +221,8 @@ static void draw_test_pattern_impl(DumbFramebuffer& fb) switch (fb.format()) { case PixelFormat::XRGB8888: case PixelFormat::XBGR8888: + case PixelFormat::ARGB8888: + case PixelFormat::ABGR8888: case PixelFormat::RGB565: for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { |