From 7db0ce19674393a4dd9af3beed236038bcfa2e65 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 14 Aug 2016 14:49:02 +0200 Subject: Experimental inline display added. --- plugintest.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'plugintest.cc') diff --git a/plugintest.cc b/plugintest.cc index 48dad58..a23c44b 100644 --- a/plugintest.cc +++ b/plugintest.cc @@ -173,6 +173,38 @@ void PluginTest::process(size_t pos, } } +bool PluginTest::hasInlineGUI() +{ + return true; +} + +void PluginTest::onInlineRedraw(std::size_t width, + std::size_t max_height, + InlineDrawContext& context) +{ + std::size_t height = std::min(width / 2, max_height); + if (!context.data || (context.width != width)) + { + delete[] context.data; + context.data = new std::uint8_t[width * height * 4]; + } + + context.width = width; + context.height = height; + + for(std::size_t x = 0; x < context.width; ++x) + { + for(std::size_t y = 0; y < context.height; ++y) + { + unsigned char* p = context.data + ((x + y * context.width) * 4); + p[0] = 0; // B; + p[1] = 0; // G + p[2] = 255; // R + p[3] = 0; // A + } + } +} + bool PluginTest::hasGUI() { return true; -- cgit v1.2.3