Permalink
Browse files

Fix Geometry when width and height are both 0

  • Loading branch information...
rmagick
rmagick committed Jun 8, 2008
1 parent 4c431d1 commit 9ceb41a03bd0a0bcb2e9f5ee15002ff8f3d14c1c
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/RMagick.rb
View
@@ -1,4 +1,4 @@
-# $Id: RMagick.rb,v 1.71 2008/06/08 13:09:49 rmagick Exp $
+# $Id: RMagick.rb,v 1.72 2008/06/08 13:41:39 rmagick Exp $
#==============================================================================
# Copyright (C) 2008 by Timothy P. Hunter
# Name: RMagick.rb
@@ -87,7 +87,6 @@ def initialize(width=nil, height=nil, x=nil, y=nil, flag=nil)
RE = /\A#{W}x?#{H}#{X}#{Y}([!<>@\^]?)\Z/
def Geometry.from_s(str)
- Kernel.raise(ArgumentError, "no geometry string specified") unless str
m = RE.match(str)
if m
@@ -114,11 +113,11 @@ def to_s
str << '%' if @flag == PercentGeometry
end
- if (@width > 0 && @flag != PercentGeometry) || (@height > 0 || @y != 0 || @x != 0)
+ if (@width > 0 && @flag != PercentGeometry) || (@height > 0)
str << 'x'
end
- if @height > 0 || @x != 0 || @y != 0
+ if @height > 0
fmt = @height.truncate == @height ? "%d" : "%.2f"
str << sprintf(fmt, @height)
str << '%' if @flag == PercentGeometry

0 comments on commit 9ceb41a

Please sign in to comment.