summaryrefslogtreecommitdiff
path: root/plugingui/window.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-02-29 16:12:26 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2020-03-07 19:22:34 +0100
commita65278c7bc9c0dbca8a74db09fd0aebf1c26ef28 (patch)
treef6137641afd154dca1c45480137e9b56afb1a7d6 /plugingui/window.cc
parent450e39c5b02ace3c50d116e4cba825ff695c8665 (diff)
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.cc16
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);
}
}