summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2019-08-04 10:35:07 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-08-04 17:54:03 +0200
commitd1f349bf772a8374a9c264bcff974d3db7ce32b9 (patch)
tree591b6f0398a7d5530c827c780e55285582a1dbf7
parent668eed3147d64c91ec923c22c47e94e8a51b5ff8 (diff)
downloadrockbox-d1f349bf772a8374a9c264bcff974d3db7ce32b9.tar.gz
rockbox-d1f349bf772a8374a9c264bcff974d3db7ce32b9.zip
lua optimize print include, fix draw_poly
Change-Id: Ibb530cfa63681727be518173404952e897c9d297
-rw-r--r--apps/plugins/lua/include_lua/draw_poly.lua2
-rw-r--r--apps/plugins/lua/include_lua/print.lua8
-rw-r--r--apps/plugins/lua_scripts/print_lua_func.lua6
3 files changed, 12 insertions, 4 deletions
diff --git a/apps/plugins/lua/include_lua/draw_poly.lua b/apps/plugins/lua/include_lua/draw_poly.lua
index fd76a582b1..0354a5fdfd 100644
--- a/apps/plugins/lua/include_lua/draw_poly.lua
+++ b/apps/plugins/lua/include_lua/draw_poly.lua
@@ -29,6 +29,8 @@
29if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end 29if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
30 30
31local _poly = {} do 31local _poly = {} do
32 -- Internal Constants
33 local rocklib_image = getmetatable(rb.lcd_framebuffer())
32 local BSAND = 8 -- blits color to dst if src <> 0 34 local BSAND = 8 -- blits color to dst if src <> 0
33 local _NIL = nil -- nil placeholder 35 local _NIL = nil -- nil placeholder
34 36
diff --git a/apps/plugins/lua/include_lua/print.lua b/apps/plugins/lua/include_lua/print.lua
index 87fd11d4b6..5ea0423f01 100644
--- a/apps/plugins/lua/include_lua/print.lua
+++ b/apps/plugins/lua/include_lua/print.lua
@@ -299,23 +299,23 @@ local _print = {} do
299 end 299 end
300 300
301 -- Helper function that acts mostly like a normal printf() would 301 -- Helper function that acts mostly like a normal printf() would
302 local function printf(...) 302 local function printf(fmt, v1, ...)
303 local o = get_settings(true) 303 local o = get_settings(true)
304 local w, h, msg 304 local w, h, msg
305 local line = o.line - 1 -- rb is 0-based lua is 1-based 305 local line = o.line - 1 -- rb is 0-based lua is 1-based
306 306
307 if not (...) or (...) == "\n" then -- handles blank line / single '\n' 307 if not (fmt) or (fmt) == "\n" then -- handles blank line / single '\n'
308 local res, w, h = text_extent(" ", o.font) 308 local res, w, h = text_extent(" ", o.font)
309 309
310 clear_line(o, line, h) 310 clear_line(o, line, h)
311 update_line(o.autoupdate, o, line, h) 311 update_line(o.autoupdate, o, line, h)
312 312
313 if (...) then set_line(_NIL) end 313 if (fmt) then set_line(_NIL) end
314 314
315 return o.line, o.max_line, o.width, h 315 return o.line, o.max_line, o.width, h
316 end 316 end
317 317
318 msg = string.format(...) 318 msg = string.format(fmt, v1, ...)
319 319
320 show_selected(o.line, msg) 320 show_selected(o.line, msg)
321 321
diff --git a/apps/plugins/lua_scripts/print_lua_func.lua b/apps/plugins/lua_scripts/print_lua_func.lua
index f2642a187b..ef0290bbd8 100644
--- a/apps/plugins/lua_scripts/print_lua_func.lua
+++ b/apps/plugins/lua_scripts/print_lua_func.lua
@@ -4,7 +4,13 @@ require "audio"
4require "buttons" 4require "buttons"
5require "color" 5require "color"
6require "draw" 6require "draw"
7require "draw_floodfill"
8require "draw_poly"
9require "draw_text"
10
7require "image" 11require "image"
12require "image_save"
13
8require "lcd" 14require "lcd"
9require "math_ex" 15require "math_ex"
10require "pcm" 16require "pcm"