Skip to content
Snippets Groups Projects
Commit ae29b0d9 authored by Alex Ksandra's avatar Alex Ksandra
Browse files

Goodbye infinite GPU memory hog, you will not be missed.

parent f4300418
No related branches found
No related tags found
1 merge request!108Font.draw convert
......@@ -27,7 +27,6 @@ module(..., package.seeall, class.make)
local gfx_prefix = "/data/gfx/"
local cache = {}
local tcache = {}
local fcache = {}
-- Default font
_M.font = core.display.newFont("/data/font/DroidSans.ttf", 12)
......@@ -94,7 +93,6 @@ end
function _M:clearCache()
cache = {}
tcache = {}
fcache = {}
end
function _M:getImage(file, noerror)
......@@ -120,12 +118,9 @@ function _M:getUITexture(file)
end
function _M:drawFontLine(font, text, width) -- always draw with white, outputting texture can have it changed
local cached = table.getTable(fcache, font, font:getStyle())
if cached[text] then return cached[text] end
width = width or font:size(text)
local tex = font:draw(text, width, 255, 255, 255, true)[1]
local r = {t = tex._tex, w=tex.w, h=tex.h, tw=tex._tex_w, th=tex._tex_h}
cached[text] = r
return r
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment