diff options
author | Jyri Sarha <jsarha@ti.com> | 2016-08-10 23:16:39 +0300 |
---|---|---|
committer | Jyri Sarha <jsarha@ti.com> | 2016-08-11 12:20:29 +0300 |
commit | 3788242e4fdc57b1421b4721120477ebb2298e52 (patch) | |
tree | c2b0c7fe512daaee254859fa530bafd5972a9796 /kms++util/src/drawing.cpp | |
parent | bd5f6471e619a6ba2987bc7f66ef78a531f94d6c (diff) |
Add BGR888 (BG24) and BGR565 (BG16) pixelformats.
Note colorbar does not support 24 bit modes (RGB888 or BGR888) yet.
Diffstat (limited to 'kms++util/src/drawing.cpp')
-rw-r--r-- | kms++util/src/drawing.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp index 157c799..44634e1 100644 --- a/kms++util/src/drawing.cpp +++ b/kms++util/src/drawing.cpp @@ -31,12 +31,26 @@ void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color) p[2] = color.b; break; } + case PixelFormat::BGR888: + { + uint8_t *p = buf.map(0) + buf.stride(0) * y + x * 3; + p[0] = color.b; + p[1] = color.g; + p[2] = color.r; + break; + } case PixelFormat::RGB565: { uint16_t *p = (uint16_t*)(buf.map(0) + buf.stride(0) * y + x * 2); *p = color.rgb565(); break; } + case PixelFormat::BGR565: + { + uint16_t *p = (uint16_t*)(buf.map(0) + buf.stride(0) * y + x * 2); + *p = color.bgr565(); + break; + } default: throw std::invalid_argument("invalid pixelformat"); } @@ -159,7 +173,9 @@ static void draw_char(IMappedFramebuffer& buf, uint32_t xpos, uint32_t ypos, cha case PixelFormat::ARGB8888: case PixelFormat::ABGR8888: case PixelFormat::RGB888: + case PixelFormat::BGR888: case PixelFormat::RGB565: + case PixelFormat::BGR565: for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) { bool b = get_char_pixel(c, x, y); |