forked from len0rd/rockbox
lua optimize print include, fix draw_poly
Change-Id: Ibb530cfa63681727be518173404952e897c9d297
This commit is contained in:
parent
668eed3147
commit
d1f349bf77
3 changed files with 12 additions and 4 deletions
|
|
@ -29,6 +29,8 @@
|
||||||
if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
|
if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
|
||||||
|
|
||||||
local _poly = {} do
|
local _poly = {} do
|
||||||
|
-- Internal Constants
|
||||||
|
local rocklib_image = getmetatable(rb.lcd_framebuffer())
|
||||||
local BSAND = 8 -- blits color to dst if src <> 0
|
local BSAND = 8 -- blits color to dst if src <> 0
|
||||||
local _NIL = nil -- nil placeholder
|
local _NIL = nil -- nil placeholder
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -299,23 +299,23 @@ local _print = {} do
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Helper function that acts mostly like a normal printf() would
|
-- Helper function that acts mostly like a normal printf() would
|
||||||
local function printf(...)
|
local function printf(fmt, v1, ...)
|
||||||
local o = get_settings(true)
|
local o = get_settings(true)
|
||||||
local w, h, msg
|
local w, h, msg
|
||||||
local line = o.line - 1 -- rb is 0-based lua is 1-based
|
local line = o.line - 1 -- rb is 0-based lua is 1-based
|
||||||
|
|
||||||
if not (...) or (...) == "\n" then -- handles blank line / single '\n'
|
if not (fmt) or (fmt) == "\n" then -- handles blank line / single '\n'
|
||||||
local res, w, h = text_extent(" ", o.font)
|
local res, w, h = text_extent(" ", o.font)
|
||||||
|
|
||||||
clear_line(o, line, h)
|
clear_line(o, line, h)
|
||||||
update_line(o.autoupdate, o, line, h)
|
update_line(o.autoupdate, o, line, h)
|
||||||
|
|
||||||
if (...) then set_line(_NIL) end
|
if (fmt) then set_line(_NIL) end
|
||||||
|
|
||||||
return o.line, o.max_line, o.width, h
|
return o.line, o.max_line, o.width, h
|
||||||
end
|
end
|
||||||
|
|
||||||
msg = string.format(...)
|
msg = string.format(fmt, v1, ...)
|
||||||
|
|
||||||
show_selected(o.line, msg)
|
show_selected(o.line, msg)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,13 @@ require "audio"
|
||||||
require "buttons"
|
require "buttons"
|
||||||
require "color"
|
require "color"
|
||||||
require "draw"
|
require "draw"
|
||||||
|
require "draw_floodfill"
|
||||||
|
require "draw_poly"
|
||||||
|
require "draw_text"
|
||||||
|
|
||||||
require "image"
|
require "image"
|
||||||
|
require "image_save"
|
||||||
|
|
||||||
require "lcd"
|
require "lcd"
|
||||||
require "math_ex"
|
require "math_ex"
|
||||||
require "pcm"
|
require "pcm"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue