From 79cc854ae63fec26ec3422a3fcac46664294ebe9 Mon Sep 17 00:00:00 2001 From: Jacob Llamas Date: Tue, 10 Apr 2012 16:20:30 -0700 Subject: [PATCH] Removed a check to see if the destination is smaller than the source. The gem should just resize the image to whenever it is handed. --- ext/imforger/imforger.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ext/imforger/imforger.c b/ext/imforger/imforger.c index e496cb5..a018548 100644 --- a/ext/imforger/imforger.c +++ b/ext/imforger/imforger.c @@ -74,18 +74,14 @@ static VALUE imforger_save_file(VALUE self, VALUE outputString) r_maxwidth = rb_hash_aref(r_options, ID2SYM(rb_intern("maxwidth"))); r_maxheight = rb_hash_aref(r_options, ID2SYM(rb_intern("maxheight"))); if(r_maxwidth != Qnil){ - if(width > NUM2INT(r_maxwidth)){ - scale = NUM2INT(r_maxwidth) / (float)width; - width = NUM2INT(r_maxwidth); - height = (int)(scale * height); - } + scale = NUM2INT(r_maxwidth) / (float)width; + width = NUM2INT(r_maxwidth); + height = (int)(scale * height); } if(r_maxheight != Qnil){ - if(height > NUM2INT(r_maxheight)){ - scale = NUM2INT(r_maxheight) / (float)height; - height = NUM2INT(r_maxheight); - width = (int)(scale * width); - } + scale = NUM2INT(r_maxheight) / (float)height; + height = NUM2INT(r_maxheight); + width = (int)(scale * width); } /* set the image1 format