diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-02-29 16:12:26 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-02-29 17:32:33 +0100 |
commit | 15e9d38d36573ba0e1ec6e0cc2768b12ca01bff0 (patch) | |
tree | 5bceab5dfb37941cbc055a978780ed0a777228e5 /plugingui/window.cc | |
parent | df32a5c6a6f8e204a757f68f0a61ea6f4843c569 (diff) |
WIP: 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.
Diffstat (limited to 'plugingui/window.cc')
-rw-r--r-- | plugingui/window.cc | 16 |
1 files changed, 9 insertions, 7 deletions
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); } } |