diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-10-03 12:32:52 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-10-03 12:33:11 +0300 |
commit | fab9bb700372008130e5026fa9fe5fd22ac6ec4e (patch) | |
tree | 1e83b437762697ab833bd8c22896b8733593ca5f /kms++util/src | |
parent | 33f343d18d5d1886dd04314bded1781c3e46f7e7 (diff) |
Rework framebuffer classes
Drop (I)MappedFramebuffer, as it doesn't really provide any value, and
have most of the methods be present in IFramebuffer with default
exception throwing implementation.
This gives us simpler way to use the framebuffers, as almost always we
can just use a pointer to IFramebuffer.
Diffstat (limited to 'kms++util/src')
-rw-r--r-- | kms++util/src/colorbar.cpp | 8 | ||||
-rw-r--r-- | kms++util/src/drawing.cpp | 12 | ||||
-rw-r--r-- | kms++util/src/testpat.cpp | 8 |
3 files changed, 14 insertions, 14 deletions
diff --git a/kms++util/src/colorbar.cpp b/kms++util/src/colorbar.cpp index e2d257b..c08ed9d 100644 --- a/kms++util/src/colorbar.cpp +++ b/kms++util/src/colorbar.cpp @@ -35,7 +35,7 @@ static const uint16_t colors16[] = { colors32[11].rgb565(), }; -static void drm_draw_color_bar_rgb888(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) +static void drm_draw_color_bar_rgb888(IFramebuffer& buf, int old_xpos, int xpos, int width) { for (unsigned y = 0; y < buf.height(); ++y) { RGB bcol = colors32[y * ARRAY_SIZE(colors32) / buf.height()]; @@ -51,7 +51,7 @@ static void drm_draw_color_bar_rgb888(IMappedFramebuffer& buf, int old_xpos, int } } -static void drm_draw_color_bar_rgb565(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) +static void drm_draw_color_bar_rgb565(IFramebuffer& buf, int old_xpos, int xpos, int width) { static_assert(ARRAY_SIZE(colors32) == ARRAY_SIZE(colors16), "bad colors arrays"); @@ -69,7 +69,7 @@ static void drm_draw_color_bar_rgb565(IMappedFramebuffer& buf, int old_xpos, int } } -static void drm_draw_color_bar_semiplanar_yuv(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) +static void drm_draw_color_bar_semiplanar_yuv(IFramebuffer& buf, int old_xpos, int xpos, int width) { const uint8_t colors[] = { 0xff, @@ -97,7 +97,7 @@ static void drm_draw_color_bar_semiplanar_yuv(IMappedFramebuffer& buf, int old_x } } -void draw_color_bar(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) +void draw_color_bar(IFramebuffer& buf, int old_xpos, int xpos, int width) { switch (buf.format()) { case PixelFormat::NV12: diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp index ffb7feb..a187dc0 100644 --- a/kms++util/src/drawing.cpp +++ b/kms++util/src/drawing.cpp @@ -6,7 +6,7 @@ using namespace std; namespace kms { -void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color) +void draw_rgb_pixel(IFramebuffer& buf, unsigned x, unsigned y, RGB color) { switch (buf.format()) { case PixelFormat::XRGB8888: @@ -56,7 +56,7 @@ void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color) } } -void draw_yuv422_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2) +void draw_yuv422_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2) { ASSERT((x & 1) == 0); @@ -101,7 +101,7 @@ void draw_yuv422_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV } } -void draw_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, +void draw_yuv420_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4) { ASSERT((x & 1) == 0); @@ -143,7 +143,7 @@ void draw_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, } } -void draw_rect(IMappedFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) +void draw_rect(IFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) { unsigned i, j; YUV yuvcolor = color.yuv(); @@ -199,7 +199,7 @@ static bool get_char_pixel(char c, uint32_t x, uint32_t y) return bit; } -static void draw_char(IMappedFramebuffer& buf, uint32_t xpos, uint32_t ypos, char c, RGB color) +static void draw_char(IFramebuffer& buf, uint32_t xpos, uint32_t ypos, char c, RGB color) { unsigned x, y; YUV yuvcolor = color.yuv(); @@ -257,7 +257,7 @@ static void draw_char(IMappedFramebuffer& buf, uint32_t xpos, uint32_t ypos, cha } } -void draw_text(IMappedFramebuffer& buf, uint32_t x, uint32_t y, const string& str, RGB color) +void draw_text(IFramebuffer& buf, uint32_t x, uint32_t y, const string& str, RGB color) { for(unsigned i = 0; i < str.size(); i++) draw_char(buf, (x + 8 * i), y, str[i], color); diff --git a/kms++util/src/testpat.cpp b/kms++util/src/testpat.cpp index faacda3..cf43d00 100644 --- a/kms++util/src/testpat.cpp +++ b/kms++util/src/testpat.cpp @@ -13,7 +13,7 @@ using namespace std; namespace kms { -static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y) +static RGB get_test_pattern_pixel(IFramebuffer& fb, unsigned x, unsigned y) { const unsigned w = fb.width(); const unsigned h = fb.height(); @@ -97,7 +97,7 @@ static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y } } -static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, unsigned end_y, YUVType yuvt) +static void draw_test_pattern_part(IFramebuffer& fb, unsigned start_y, unsigned end_y, YUVType yuvt) { unsigned x, y; unsigned w = fb.width(); @@ -151,7 +151,7 @@ static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, uns } } -static void draw_test_pattern_impl(IMappedFramebuffer& fb, YUVType yuvt) +static void draw_test_pattern_impl(IFramebuffer& fb, YUVType yuvt) { if (fb.height() < 20) { draw_test_pattern_part(fb, 0, fb.height(), yuvt); @@ -181,7 +181,7 @@ static void draw_test_pattern_impl(IMappedFramebuffer& fb, YUVType yuvt) t.join(); } -void draw_test_pattern(IMappedFramebuffer &fb, YUVType yuvt) +void draw_test_pattern(IFramebuffer &fb, YUVType yuvt) { #ifdef DRAW_PERF_PRINT Stopwatch sw; |