aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2017-05-06 21:54:07 +0200
committerAlex Auvolat <alex@adnab.me>2017-05-06 21:54:07 +0200
commite72e5e87497744410fb62843ef852d26bf5277d2 (patch)
treef1d08eef80f1665d37e6e04a1a08cba000a24443
parente78c261b13e071bd287e15a2e9fcb7641b0fb40c (diff)
downloadkogata-e72e5e87497744410fb62843ef852d26bf5277d2.tar.gz
kogata-e72e5e87497744410fb62843ef852d26bf5277d2.zip
Bug fix
-rw-r--r--src/lib/libkogata/draw.c2
-rw-r--r--src/syslua/lx/tk.lua5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libkogata/draw.c b/src/lib/libkogata/draw.c
index 1b4f225..66da6f0 100644
--- a/src/lib/libkogata/draw.c
+++ b/src/lib/libkogata/draw.c
@@ -223,7 +223,7 @@ inline void g_region_vline(fb_t *fb, fb_region_t *reg, int x, int y, int h, colo
if (y >= reg->h) return;
if (y + h < 0) return;
if (y + h > reg->h) h = reg->h - y;
- if (x < 0 || x >= reg->h) return;
+ if (x < 0 || x >= reg->w) return;
if (h <= 0) return;
g_vline(fb, reg->x + x, reg->y + y, h, c);
diff --git a/src/syslua/lx/tk.lua b/src/syslua/lx/tk.lua
index ceacba9..cc95bbe 100644
--- a/src/syslua/lx/tk.lua
+++ b/src/syslua/lx/tk.lua
@@ -69,6 +69,8 @@ end
function tk.widget(width, height)
local w = {
+ x = 0,
+ y = 0,
width = width,
height = height,
}
@@ -248,8 +250,7 @@ function tk.wm_widget()
self.x = self.x + nx - px
self.y = self.y + ny - py
local reg2 = {x = self.x, y = self.y, w = self.width, h = self.height}
- local pieces = region_diff(reg1, reg2)
- table.insert(pieces, reg2)
+ local pieces = region_union(reg1, reg2)
for _, p in pairs(pieces) do
wm:redraw_region(p.x, p.y, p.w, p.h)
end