Better handling of empty files

This commit is contained in:
Andy Meneely
2014-07-29 23:50:56 -04:00
parent a71fd8f81a
commit 5c6149ad5a
3 changed files with 9 additions and 7 deletions
+2
View File
@@ -4,6 +4,7 @@ module Squib
# :nodoc:
# @api private
def png(file, x, y, alpha)
return if file.nil? or file.eql? ''
cc = cairo_context
png = Cairo::ImageSurface.from_png(file)
cc.set_source(png, x, y)
@@ -13,6 +14,7 @@ module Squib
# :nodoc:
# @api private
def svg(file, id, x, y, width, height)
return if file.nil? or file.eql? ''
svg = RSVG::Handle.new_from_file(file)
width = svg.width if width == :native
height = svg.height if height == :native