imagebox: Allow to load SVG data without saving it.

This commit is contained in:
Emmanuel Lepage Vallee 2021-09-11 16:27:44 -07:00
parent 3f2db184ad
commit ddccddb6dc
1 changed files with 9 additions and 1 deletions

View File

@ -57,11 +57,19 @@ local function load_rsvg_handle(file)
if not Rsvg then return end
local cache = rsvg_handle_cache[file]
if cache then
return cache
end
local handle, err = Rsvg.Handle.new_from_file(file)
local handle, err = nil, nil
if file:match("<[?]?xml") then
handle, err = Rsvg.Handle.new_from_data(file)
else
handle, err = Rsvg.Handle.new_from_file(file)
end
if not err then
rsvg_handle_cache[file] = handle
return handle