imagebox: Allow to load SVG data without saving it.
This commit is contained in:
parent
3f2db184ad
commit
ddccddb6dc
|
@ -57,11 +57,19 @@ local function load_rsvg_handle(file)
|
||||||
if not Rsvg then return end
|
if not Rsvg then return end
|
||||||
|
|
||||||
local cache = rsvg_handle_cache[file]
|
local cache = rsvg_handle_cache[file]
|
||||||
|
|
||||||
if cache then
|
if cache then
|
||||||
return cache
|
return cache
|
||||||
end
|
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
|
if not err then
|
||||||
rsvg_handle_cache[file] = handle
|
rsvg_handle_cache[file] = handle
|
||||||
return handle
|
return handle
|
||||||
|
|
Loading…
Reference in New Issue