summaryrefslogtreecommitdiff
path: root/src/user/raleigh/w/button.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-03-08 18:06:38 -0500
committerBenji Dial <benji6283@gmail.com>2021-03-08 18:06:38 -0500
commitfd4557c4adddf710979a42e9f9d470bc8b3f77bd (patch)
tree485ff6f0514cc1918f8758927a1e2da2198e7d8a /src/user/raleigh/w/button.cpp
parent920f1f010284d59bad86f78355ed90ac2f3e1d2c (diff)
downloadportland-os-fd4557c4adddf710979a42e9f9d470bc8b3f77bd.tar.gz
hbox, better painting logic in raleigh
Diffstat (limited to 'src/user/raleigh/w/button.cpp')
-rw-r--r--src/user/raleigh/w/button.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/user/raleigh/w/button.cpp b/src/user/raleigh/w/button.cpp
index 224b930..da88f6a 100644
--- a/src/user/raleigh/w/button.cpp
+++ b/src/user/raleigh/w/button.cpp
@@ -18,18 +18,22 @@ namespace raleigh {
}
void button::paint(_pixel_t *pixbuf, uint32_t pitch) {
+ if (next_paint_full) {
+ next_paint_full = false;
+ for (uint32_t x = window_offset.x; x < window_offset.x + size.x; ++x) {
+ pixbuf[window_offset.y * pitch + x] = border_color;
+ pixbuf[(window_offset.y + size.y - 1) * pitch + x] = border_color;
+ }
+ for (uint32_t y = window_offset.y + 1; y < window_offset.y + size.y - 1; ++y) {
+ pixbuf[y * pitch + window_offset.x] = border_color;
+ pixbuf[y * pitch + window_offset.x + size.x - 1] = border_color;
+ }
+ }
for (uint32_t y = window_offset.y + 1; y < window_offset.y + size.y - 1; ++y)
for (uint32_t x = window_offset.x + 1; x < window_offset.x + size.x - 1; ++x)
pixbuf[y * pitch + x] = is_pressed ? pressed_color : bg_color;
+ inner.next_paint_full = true;
inner.paint(pixbuf, pitch);
- for (uint32_t x = window_offset.x; x < window_offset.x + size.x; ++x) {
- pixbuf[window_offset.y * pitch + x] = border_color;
- pixbuf[(window_offset.y + size.y - 1) * pitch + x] = border_color;
- }
- for (uint32_t y = window_offset.y + 1; y < window_offset.y + size.y - 1; ++y) {
- pixbuf[y * pitch + window_offset.x] = border_color;
- pixbuf[y * pitch + window_offset.x + size.x - 1] = border_color;
- }
}
void button::handle_click(coord window_coords, enum mouse_packet::mouse_button click_type, bool up) {