lib/ios/sugarcube-image/uiimage.rb in sugarcube-2.0.2 vs lib/ios/sugarcube-image/uiimage.rb in sugarcube-2.1.0
- old
+ new
@@ -29,10 +29,10 @@
else
options = more_options
size = options_or_size
end
raise ":size is required in #{self.name}##canvas" unless size
- scale = options[:scale] || UIScreen.mainScreen.scale
+ scale = options.fetch(:scale, 0.0) # not a typo, 0.0 indicates "use default"
opaque = options.fetch(:opaque, false)
UIGraphicsBeginImageContextWithOptions(size, opaque, scale)
block.call(UIGraphicsGetCurrentContext()) if block
new_image = UIGraphicsGetImageFromCurrentImageContext()