From a65278c7bc9c0dbca8a74db09fd0aebf1c26ef28 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 29 Feb 2020 16:12:26 +0100 Subject: Read images as uint8_t instead of float. Convert Colour and all colour related operations to use uint8_t instade of float and finally optimize rendering to render lines instead of single pixels. --- plugingui/window.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'plugingui/window.cc') diff --git a/plugingui/window.cc b/plugingui/window.cc index a9deed5..acde008 100644 --- a/plugingui/window.cc +++ b/plugingui/window.cc @@ -349,8 +349,6 @@ bool Window::updateBuffer() update_height = ((int)wpixbuf.height - pixel_buffer->y); } - std::uint8_t r, g, b, a; - auto from_x = (int)dirty_rect.x1 - pixel_buffer->x; from_x = std::max(0, from_x); auto from_y = (int)dirty_rect.y1 - pixel_buffer->y; @@ -361,13 +359,17 @@ bool Window::updateBuffer() auto to_y = (int)dirty_rect.y2 - pixel_buffer->y; to_y = std::min(to_y, (int)update_height); + if(to_x < from_x) + { + continue; + } + for(int y = from_y; y < to_y; y++) { - for(int x = from_x; x < to_x; x++) - { - pixel_buffer->pixel(x, y, &r, &g, &b, &a); - wpixbuf.setPixel(x + pixel_buffer->x, y + pixel_buffer->y, r, g, b, a); - } + wpixbuf.writeLine(pixel_buffer->x + from_x, + pixel_buffer->y + y, + pixel_buffer->getLine(from_x, y), + to_x - from_x); } } -- cgit v1.2.3