From 83d27aa30549194068fef320f735245a7735a5ea Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 15 Mar 2016 11:46:09 +0200 Subject: Add IMappedFramebuffer and remove MappedBuffer --- libkmstest/testpat.cpp | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'libkmstest/testpat.cpp') diff --git a/libkmstest/testpat.cpp b/libkmstest/testpat.cpp index 059c1bc..c0541bb 100644 --- a/libkmstest/testpat.cpp +++ b/libkmstest/testpat.cpp @@ -13,13 +13,13 @@ #include "kms++.h" #include "test.h" -#include "mappedbuffer.h" +#include "cpuframebuffer.h" #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) namespace kms { -static void draw_rgb_pixel(MappedBuffer& buf, unsigned x, unsigned y, RGB color) +static void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color) { switch (buf.format()) { case PixelFormat::XRGB8888: @@ -47,7 +47,7 @@ static void draw_rgb_pixel(MappedBuffer& buf, unsigned x, unsigned y, RGB color) } } -static void draw_yuv422_macropixel(MappedBuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2) +static void draw_yuv422_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2) { ASSERT((x & 1) == 0); @@ -92,7 +92,7 @@ static void draw_yuv422_macropixel(MappedBuffer& buf, unsigned x, unsigned y, YU } } -static void draw_yuv420_macropixel(MappedBuffer& buf, unsigned x, unsigned y, +static void draw_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4) { ASSERT((x & 1) == 0); @@ -134,7 +134,7 @@ static void draw_yuv420_macropixel(MappedBuffer& buf, unsigned x, unsigned y, } } -static RGB get_test_pattern_pixel(MappedBuffer& fb, unsigned x, unsigned y) +static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y) { const unsigned w = fb.width(); const unsigned h = fb.height(); @@ -215,7 +215,7 @@ static RGB get_test_pattern_pixel(MappedBuffer& fb, unsigned x, unsigned y) } } -static void draw_test_pattern_impl(MappedBuffer& fb) +static void draw_test_pattern_impl(IMappedFramebuffer& fb) { unsigned x, y; unsigned w = fb.width(); @@ -267,13 +267,7 @@ static void draw_test_pattern_impl(MappedBuffer& fb) } } -void draw_test_pattern(DumbFramebuffer &fb) -{ - MappedDumbBuffer mfb(fb); - draw_test_pattern(mfb); -} - -void draw_test_pattern(MappedBuffer &fb) +void draw_test_pattern(IMappedFramebuffer &fb) { #ifdef DRAW_PERF_PRINT using namespace std::chrono; @@ -291,7 +285,7 @@ void draw_test_pattern(MappedBuffer &fb) #endif } -void draw_rect(MappedBuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) +void draw_rect(IMappedFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) { for (unsigned i = x; i < x + w; ++i) { for (unsigned j = y; j < y + h; ++j) { @@ -300,10 +294,4 @@ void draw_rect(MappedBuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, } } -void draw_rect(DumbFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) -{ - MappedDumbBuffer mfb(fb); - draw_rect(mfb, x, y, w, h, color); -} - } -- cgit v1.2.3