summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kms++util/inc/kms++util/kms++util.h2
-rw-r--r--kms++util/src/drawing.cpp7
-rw-r--r--py/pykms/pykmsutil.cpp6
3 files changed, 14 insertions, 1 deletions
diff --git a/kms++util/inc/kms++util/kms++util.h b/kms++util/inc/kms++util/kms++util.h
index 8fc6c8b..58ad7e6 100644
--- a/kms++util/inc/kms++util/kms++util.h
+++ b/kms++util/inc/kms++util/kms++util.h
@@ -29,6 +29,8 @@ void draw_text(IFramebuffer& buf, uint32_t x, uint32_t y, const std::string& str
void draw_color_bar(IFramebuffer& buf, int old_xpos, int xpos, int width);
void draw_test_pattern(IFramebuffer &fb, YUVType yuvt = YUVType::BT601_Lim);
+
+void dump_framebuffer(IFramebuffer &fb, int fd);
}
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp
index 3752f94..24a9954 100644
--- a/kms++util/src/drawing.cpp
+++ b/kms++util/src/drawing.cpp
@@ -1,5 +1,6 @@
#include <cmath>
+#include <unistd.h>
#include <kms++/kms++.h>
#include <kms++util/kms++util.h>
@@ -569,4 +570,10 @@ void draw_text(IFramebuffer& buf, uint32_t x, uint32_t y, const string& str, RGB
draw_char(buf, (x + 8 * i), y, str[i], color);
}
+void dump_framebuffer(IFramebuffer &fb, int fd)
+{
+ for (unsigned int i = 0; i < fb.num_planes(); ++i)
+ ::write(fd, fb.map(i), fb.size(i));
+}
+
}
diff --git a/py/pykms/pykmsutil.cpp b/py/pykms/pykmsutil.cpp
index d5d7fde..92d8ebc 100644
--- a/py/pykms/pykmsutil.cpp
+++ b/py/pykms/pykmsutil.cpp
@@ -61,5 +61,9 @@ void init_pykmstest(py::module &m)
draw_circle(fb, xCenter, yCenter, radius, color);
} );
m.def("draw_text", [](Framebuffer& fb, uint32_t x, uint32_t y, const string& str, RGB color) {
- draw_text(fb, x, y, str, color); } );
+ draw_text(fb, x, y, str, color);
+ } );
+ m.def("dump_framebuffer", [](Framebuffer& fb, int fd) {
+ dump_framebuffer(fb, fd);
+ } );
}