summaryrefslogtreecommitdiff
path: root/plugintest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugintest.cc')
-rw-r--r--plugintest.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/plugintest.cc b/plugintest.cc
index a23c44b..cbe34fe 100644
--- a/plugintest.cc
+++ b/plugintest.cc
@@ -182,25 +182,27 @@ void PluginTest::onInlineRedraw(std::size_t width,
std::size_t max_height,
InlineDrawContext& context)
{
- std::size_t height = std::min(width / 2, max_height);
+ std::size_t height = std::min(width, 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;
+ context.data = (unsigned char*)inlineDisplayBuffer;
}
- context.width = width;
- context.height = height;
+
+ std::cout << "width: " << width << " height: " << height << std::endl;
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
+ inlineDisplayBuffer[x + y * context.width] =
+ pgzRGBA(lround(255 * (float(x) / float(context.width))),
+ lround(255 * (1 + -1 * (float(x) / float(context.width)))),
+ lround(255 * (float(y) / float(context.height))),
+ 0); // Apparently not used
}
}
}