From fab9bb700372008130e5026fa9fe5fd22ac6ec4e Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 3 Oct 2017 12:32:52 +0300 Subject: 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. --- kms++/inc/kms++/dumbframebuffer.h | 4 ++-- kms++/inc/kms++/extframebuffer.h | 4 ++-- kms++/inc/kms++/framebuffer.h | 35 +++++++++++++++-------------- kms++/inc/kms++/kms++.h | 1 - kms++/inc/kms++/mappedframebuffer.h | 23 ------------------- kms++/inc/kms++/omap/omapframebuffer.h | 4 ++-- kms++/src/dumbframebuffer.cpp | 2 +- kms++/src/extframebuffer.cpp | 4 ++-- kms++/src/mappedframebuffer.cpp | 20 ----------------- kms++/src/omap/omapframebuffer.cpp | 2 +- kms++util/inc/kms++util/cpuframebuffer.h | 2 +- kms++util/inc/kms++util/extcpuframebuffer.h | 2 +- kms++util/inc/kms++util/kms++util.h | 16 ++++++------- kms++util/src/colorbar.cpp | 8 +++---- kms++util/src/drawing.cpp | 12 +++++----- kms++util/src/testpat.cpp | 8 +++---- py/pykms/pykmsbase.cpp | 10 ++++----- py/pykms/pykmsomap.cpp | 2 +- py/pykms/pykmsutil.cpp | 10 ++++----- utils/kmstest.cpp | 16 ++++++------- 20 files changed, 71 insertions(+), 114 deletions(-) delete mode 100644 kms++/inc/kms++/mappedframebuffer.h delete mode 100644 kms++/src/mappedframebuffer.cpp diff --git a/kms++/inc/kms++/dumbframebuffer.h b/kms++/inc/kms++/dumbframebuffer.h index 15d25d1..fb99d0e 100644 --- a/kms++/inc/kms++/dumbframebuffer.h +++ b/kms++/inc/kms++/dumbframebuffer.h @@ -1,12 +1,12 @@ #pragma once -#include "mappedframebuffer.h" +#include "framebuffer.h" #include "pixelformats.h" namespace kms { -class DumbFramebuffer : public MappedFramebuffer +class DumbFramebuffer : public Framebuffer { public: DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const std::string& fourcc); diff --git a/kms++/inc/kms++/extframebuffer.h b/kms++/inc/kms++/extframebuffer.h index 1ec614f..5f0660c 100644 --- a/kms++/inc/kms++/extframebuffer.h +++ b/kms++/inc/kms++/extframebuffer.h @@ -1,12 +1,12 @@ #pragma once -#include "mappedframebuffer.h" +#include "framebuffer.h" #include "pixelformats.h" namespace kms { -class ExtFramebuffer : public MappedFramebuffer +class ExtFramebuffer : public Framebuffer { public: ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format, diff --git a/kms++/inc/kms++/framebuffer.h b/kms++/inc/kms++/framebuffer.h index faf2e71..3d43d08 100644 --- a/kms++/inc/kms++/framebuffer.h +++ b/kms++/inc/kms++/framebuffer.h @@ -5,7 +5,24 @@ namespace kms { -class Framebuffer : public DrmObject +class IFramebuffer { +public: + virtual ~IFramebuffer() { } + + virtual uint32_t width() const = 0; + virtual uint32_t height() const = 0; + + virtual PixelFormat format() const { throw std::runtime_error("not implemented"); } + virtual unsigned num_planes() const { throw std::runtime_error("not implemented"); } + + virtual uint32_t stride(unsigned plane) const { throw std::runtime_error("not implemented"); } + virtual uint32_t size(unsigned plane) const { throw std::runtime_error("not implemented"); } + virtual uint32_t offset(unsigned plane) const { throw std::runtime_error("not implemented"); } + virtual uint8_t* map(unsigned plane) { throw std::runtime_error("not implemented"); } + virtual int prime_fd(unsigned plane) { throw std::runtime_error("not implemented"); } +}; + +class Framebuffer : public DrmObject, public IFramebuffer { public: Framebuffer(Card& card, uint32_t id); @@ -23,20 +40,4 @@ private: uint32_t m_height; }; -class IMappedFramebuffer { -public: - virtual ~IMappedFramebuffer() { } - - virtual uint32_t width() const = 0; - virtual uint32_t height() const = 0; - - virtual PixelFormat format() const = 0; - virtual unsigned num_planes() const = 0; - - virtual uint32_t stride(unsigned plane) const = 0; - virtual uint32_t size(unsigned plane) const = 0; - virtual uint32_t offset(unsigned plane) const = 0; - virtual uint8_t* map(unsigned plane) = 0; -}; - } diff --git a/kms++/inc/kms++/kms++.h b/kms++/inc/kms++/kms++.h index 6fc6977..3365ef7 100644 --- a/kms++/inc/kms++/kms++.h +++ b/kms++/inc/kms++/kms++.h @@ -8,7 +8,6 @@ #include "framebuffer.h" #include "dumbframebuffer.h" #include "extframebuffer.h" -#include "mappedframebuffer.h" #include "plane.h" #include "property.h" #include "blob.h" diff --git a/kms++/inc/kms++/mappedframebuffer.h b/kms++/inc/kms++/mappedframebuffer.h deleted file mode 100644 index 2905136..0000000 --- a/kms++/inc/kms++/mappedframebuffer.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "framebuffer.h" - -namespace kms -{ - -class MappedFramebuffer : public Framebuffer, public IMappedFramebuffer -{ -public: - virtual ~MappedFramebuffer() { } - -protected: - MappedFramebuffer(Card& card, uint32_t id); - MappedFramebuffer(Card& card, uint32_t width, uint32_t height); - -public: - virtual uint32_t width() const = 0; - virtual uint32_t height() const = 0; - -}; - -} diff --git a/kms++/inc/kms++/omap/omapframebuffer.h b/kms++/inc/kms++/omap/omapframebuffer.h index d1152b5..70bf946 100644 --- a/kms++/inc/kms++/omap/omapframebuffer.h +++ b/kms++/inc/kms++/omap/omapframebuffer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include struct omap_bo; @@ -9,7 +9,7 @@ namespace kms { class OmapCard; -class OmapFramebuffer : public MappedFramebuffer +class OmapFramebuffer : public Framebuffer { public: enum Flags diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp index 9de7ee1..b21e8ff 100644 --- a/kms++/src/dumbframebuffer.cpp +++ b/kms++/src/dumbframebuffer.cpp @@ -25,7 +25,7 @@ DumbFramebuffer::DumbFramebuffer(Card &card, uint32_t width, uint32_t height, co } DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format) - :MappedFramebuffer(card, width, height), m_format(format) + :Framebuffer(card, width, height), m_format(format) { Create(); } diff --git a/kms++/src/extframebuffer.cpp b/kms++/src/extframebuffer.cpp index f50c36e..c1f562e 100644 --- a/kms++/src/extframebuffer.cpp +++ b/kms++/src/extframebuffer.cpp @@ -14,7 +14,7 @@ namespace kms ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format, vector handles, vector pitches, vector offsets) - : MappedFramebuffer(card, width, height) + : Framebuffer(card, width, height) { m_format = format; @@ -44,7 +44,7 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, Pixe ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format, vector fds, vector pitches, vector offsets) - : MappedFramebuffer(card, width, height) + : Framebuffer(card, width, height) { int r; diff --git a/kms++/src/mappedframebuffer.cpp b/kms++/src/mappedframebuffer.cpp deleted file mode 100644 index 21e082f..0000000 --- a/kms++/src/mappedframebuffer.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -using namespace std; - -namespace kms -{ - -MappedFramebuffer::MappedFramebuffer(Card& card, uint32_t id) - : Framebuffer(card, id) -{ - -} - -MappedFramebuffer::MappedFramebuffer(Card& card, uint32_t width, uint32_t height) - : Framebuffer(card, width, height) -{ - -} - -} diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp index b27ca22..f33a286 100644 --- a/kms++/src/omap/omapframebuffer.cpp +++ b/kms++/src/omap/omapframebuffer.cpp @@ -32,7 +32,7 @@ OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height } OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format, Flags flags) - :MappedFramebuffer(card, width, height), m_omap_card(card), m_format(format) + :Framebuffer(card, width, height), m_omap_card(card), m_format(format) { Create(flags); } 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; diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp index e53fe54..258167a 100644 --- a/py/pykms/pykmsbase.cpp +++ b/py/pykms/pykmsbase.cpp @@ -102,12 +102,12 @@ void init_pykmsbase(py::module &m) py::class_(m, "Framebuffer", py::base()) ; - py::class_(m, "MappedFramebuffer", py::base()) - .def_property_readonly("width", &MappedFramebuffer::width) - .def_property_readonly("height", &MappedFramebuffer::height) + py::class_(m, "Framebuffer", py::base()) + .def_property_readonly("width", &Framebuffer::width) + .def_property_readonly("height", &Framebuffer::height) ; - py::class_(m, "DumbFramebuffer", py::base()) + py::class_(m, "DumbFramebuffer", py::base()) .def(py::init(), py::keep_alive<1, 2>()) // Keep Card alive until this is destructed .def(py::init(), @@ -119,7 +119,7 @@ void init_pykmsbase(py::module &m) .def("offset", &DumbFramebuffer::offset) ; - py::class_(m, "ExtFramebuffer", py::base()) + py::class_(m, "ExtFramebuffer", py::base()) .def(py::init, vector, vector>(), py::keep_alive<1, 2>()) // Keep Card alive until this is destructed ; diff --git a/py/pykms/pykmsomap.cpp b/py/pykms/pykmsomap.cpp index 0c3a8ee..2662a18 100644 --- a/py/pykms/pykmsomap.cpp +++ b/py/pykms/pykmsomap.cpp @@ -14,7 +14,7 @@ void init_pykmsomap(py::module &m) .def(py::init<>()) ; - py::class_ omapfb(m, "OmapFramebuffer", py::base()); + py::class_ omapfb(m, "OmapFramebuffer", py::base()); // XXX we should use py::arithmetic() here to support or and and operators, but it's not supported in the pybind11 we use py::enum_(omapfb, "Flags") diff --git a/py/pykms/pykmsutil.cpp b/py/pykms/pykmsutil.cpp index a5a6041..10dee81 100644 --- a/py/pykms/pykmsutil.cpp +++ b/py/pykms/pykmsutil.cpp @@ -47,16 +47,16 @@ void init_pykmstest(py::module &m) .value("BT709_Full", YUVType::BT709_Full) ; - // Use lambdas to handle IMappedFramebuffer - m.def("draw_test_pattern", [](MappedFramebuffer& fb, YUVType yuvt) { draw_test_pattern(fb, yuvt); }, + // Use lambdas to handle IFramebuffer + m.def("draw_test_pattern", [](Framebuffer& fb, YUVType yuvt) { draw_test_pattern(fb, yuvt); }, py::arg("fb"), py::arg("yuvt") = YUVType::BT601_Lim); - m.def("draw_color_bar", [](MappedFramebuffer& fb, int old_xpos, int xpos, int width) { + m.def("draw_color_bar", [](Framebuffer& fb, int old_xpos, int xpos, int width) { draw_color_bar(fb, old_xpos, xpos, width); } ); - m.def("draw_rect", [](MappedFramebuffer& fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) { + m.def("draw_rect", [](Framebuffer& fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) { draw_rect(fb, x, y, w, h, color); } ); - m.def("draw_text", [](MappedFramebuffer& fb, uint32_t x, uint32_t y, const string& str, RGB 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); } ); } diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index ba7d790..63b7d44 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -30,7 +30,7 @@ struct PlaneInfo unsigned view_w; unsigned view_h; - vector fbs; + vector fbs; }; struct OutputInfo @@ -41,7 +41,7 @@ struct OutputInfo Plane* primary_plane; Videomode mode; bool user_set_crtc; - vector fbs; + vector fbs; vector planes; }; @@ -288,9 +288,9 @@ static void parse_plane(Card& card, const string& plane_str, const OutputInfo& o pinfo.y = output.mode.vdisplay / 2 - pinfo.h / 2; } -static vector get_default_fb(Card& card, unsigned width, unsigned height) +static vector get_default_fb(Card& card, unsigned width, unsigned height) { - vector v; + vector v; for (unsigned i = 0; i < s_num_buffers; ++i) v.push_back(new DumbFramebuffer(card, width, height, PixelFormat::XRGB8888)); @@ -298,7 +298,7 @@ static vector get_default_fb(Card& card, unsigned width, uns return v; } -static vector parse_fb(Card& card, const string& fb_str, unsigned def_w, unsigned def_h) +static vector parse_fb(Card& card, const string& fb_str, unsigned def_w, unsigned def_h) { unsigned w = def_w; unsigned h = def_h; @@ -323,7 +323,7 @@ static vector parse_fb(Card& card, const string& fb_str, uns format = FourCCToPixelFormat(sm[3]); } - vector v; + vector v; for (unsigned i = 0; i < s_num_buffers; ++i) v.push_back(new DumbFramebuffer(card, w, h, format)); @@ -883,12 +883,12 @@ private: queue_next(); } - static unsigned get_bar_pos(MappedFramebuffer* fb, unsigned frame_num) + static unsigned get_bar_pos(Framebuffer* fb, unsigned frame_num) { return (frame_num * bar_speed) % (fb->width() - bar_width + 1); } - static void draw_bar(MappedFramebuffer* fb, unsigned frame_num) + static void draw_bar(Framebuffer* fb, unsigned frame_num) { int old_xpos = frame_num < s_num_buffers ? -1 : get_bar_pos(fb, frame_num - s_num_buffers); int new_xpos = get_bar_pos(fb, frame_num); -- cgit v1.2.3