summaryrefslogtreecommitdiff
path: root/kms++util
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2017-10-03 12:32:52 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-10-03 12:33:11 +0300
commitfab9bb700372008130e5026fa9fe5fd22ac6ec4e (patch)
tree1e83b437762697ab833bd8c22896b8733593ca5f /kms++util
parent33f343d18d5d1886dd04314bded1781c3e46f7e7 (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')
-rw-r--r--kms++util/inc/kms++util/cpuframebuffer.h2
-rw-r--r--kms++util/inc/kms++util/extcpuframebuffer.h2
-rw-r--r--kms++util/inc/kms++util/kms++util.h16
-rw-r--r--kms++util/src/colorbar.cpp8
-rw-r--r--kms++util/src/drawing.cpp12
-rw-r--r--kms++util/src/testpat.cpp8
6 files changed, 24 insertions, 24 deletions
diff --git a/kms++util/inc/kms++util/cpuframebuffer.h b/kms++util/inc/kms++util/cpuframebuffer.h
index 1498528..4273e0d 100644
--- a/kms++util/inc/kms++util/cpuframebuffer.h
+++ b/kms++util/inc/kms++util/cpuframebuffer.h
@@ -5,7 +5,7 @@
namespace kms
{
-class CPUFramebuffer : public IMappedFramebuffer {
+class CPUFramebuffer : public IFramebuffer {
public:
CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format);
diff --git a/kms++util/inc/kms++util/extcpuframebuffer.h b/kms++util/inc/kms++util/extcpuframebuffer.h
index 3652ec4..92ca43a 100644
--- a/kms++util/inc/kms++util/extcpuframebuffer.h
+++ b/kms++util/inc/kms++util/extcpuframebuffer.h
@@ -5,7 +5,7 @@
namespace kms
{
-class ExtCPUFramebuffer : public IMappedFramebuffer
+class ExtCPUFramebuffer : public IFramebuffer
{
public:
ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
diff --git a/kms++util/inc/kms++util/kms++util.h b/kms++util/inc/kms++util/kms++util.h
index d45497e..8e45b0d 100644
--- a/kms++util/inc/kms++util/kms++util.h
+++ b/kms++util/inc/kms++util/kms++util.h
@@ -15,18 +15,18 @@
namespace kms
{
-class IMappedFramebuffer;
+class IFramebuffer;
-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_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y,
+void draw_rgb_pixel(IFramebuffer& buf, unsigned x, unsigned y, RGB color);
+void draw_yuv422_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2);
+void draw_yuv420_macropixel(IFramebuffer& buf, unsigned x, unsigned y,
YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4);
-void draw_rect(IMappedFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color);
-void draw_text(IMappedFramebuffer& buf, uint32_t x, uint32_t y, const std::string& str, RGB color);
+void draw_rect(IFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color);
+void draw_text(IFramebuffer& buf, uint32_t x, uint32_t y, const std::string& str, RGB color);
-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);
-void draw_test_pattern(IMappedFramebuffer &fb, YUVType yuvt = YUVType::BT601_Lim);
+void draw_test_pattern(IFramebuffer &fb, YUVType yuvt = YUVType::BT601_Lim);
}
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
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;