gthumb r2195 - in branches/gthumb-2-10: . libgthumb src



Author: mjc
Date: Wed Jan 16 18:58:19 2008
New Revision: 2195
URL: http://svn.gnome.org/viewvc/gthumb?rev=2195&view=rev

Log:
2008-01-16  Michael J. Chudobiak  <mjc svn gnome org>

        * NEWS:
        * libgthumb/async-pixbuf-ops.c: (scale_step):
        * libgthumb/gth-file-list.c: (get_pixbuf_from_mime_type):
        * libgthumb/gth-file-view-list.c: (get_sized_pixbuf):
        * libgthumb/pixbuf-utils.c: (scale_keeping_ratio):
        * libgthumb/pixbuf-utils.h:
        * libgthumb/print-callbacks.c: (image_loader_done_cb):
        * libgthumb/thumb-loader.c: (thumb_loader_done_cb):
        * src/catalog-png-exporter.c: (image_loader_done):
        * src/catalog-web-exporter.c: (gth_parsed_doc_print),
        (image_loader_done):
        * src/dlg-brightness-contrast.c: (dlg_brightness_contrast):
        * src/dlg-color-balance.c: (dlg_color_balance):
        * src/dlg-hue-saturation.c: (dlg_hue_saturation):
        * src/dlg-image-prop.c: (update_general_info):
        * src/dlg-jpegtran.c: (_gdk_pixbuf_scale_keep_aspect_ratio):
        * src/dlg-posterize.c: (dlg_posterize):
        * src/dlg-web-exporter.c: (theme_dialog__sel_changed_cb):
        * src/main.c: (get_fs_icon):

        Fixed bug #508873 - gthumb cannot scale up images, by adding
        boolean parameter to permit upscaling in scale_keeping_ratio.
        Spelling: scale_keepping_ratio -> scale_keeping_ratio.



Modified:
   branches/gthumb-2-10/ChangeLog
   branches/gthumb-2-10/NEWS
   branches/gthumb-2-10/libgthumb/async-pixbuf-ops.c
   branches/gthumb-2-10/libgthumb/gth-file-list.c
   branches/gthumb-2-10/libgthumb/gth-file-view-list.c
   branches/gthumb-2-10/libgthumb/pixbuf-utils.c
   branches/gthumb-2-10/libgthumb/pixbuf-utils.h
   branches/gthumb-2-10/libgthumb/print-callbacks.c
   branches/gthumb-2-10/libgthumb/thumb-loader.c
   branches/gthumb-2-10/src/catalog-png-exporter.c
   branches/gthumb-2-10/src/catalog-web-exporter.c
   branches/gthumb-2-10/src/dlg-brightness-contrast.c
   branches/gthumb-2-10/src/dlg-color-balance.c
   branches/gthumb-2-10/src/dlg-hue-saturation.c
   branches/gthumb-2-10/src/dlg-image-prop.c
   branches/gthumb-2-10/src/dlg-jpegtran.c
   branches/gthumb-2-10/src/dlg-posterize.c
   branches/gthumb-2-10/src/dlg-web-exporter.c
   branches/gthumb-2-10/src/main.c

Modified: branches/gthumb-2-10/NEWS
==============================================================================
--- branches/gthumb-2-10/NEWS	(original)
+++ branches/gthumb-2-10/NEWS	Wed Jan 16 18:58:19 2008
@@ -1,3 +1,8 @@
+version 2.10.9
+--------------
+
+	* Fixed bug #508873 - gthumb cannot scale up images
+
 version 2.10.8
 --------------
 

Modified: branches/gthumb-2-10/libgthumb/async-pixbuf-ops.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/async-pixbuf-ops.c	(original)
+++ branches/gthumb-2-10/libgthumb/async-pixbuf-ops.c	Wed Jan 16 18:58:19 2008
@@ -1577,8 +1577,9 @@
 	} else if (data->keep_ratio) {
 		new_w = w;
 		new_h = h;
-		scale_keepping_ratio (&new_w, &new_h,
-				      data->width, data->height);
+		scale_keeping_ratio (&new_w, &new_h,
+				     data->width, data->height,
+				     TRUE);
 	} else {
 		new_w = data->width;
 		new_h = data->height;

Modified: branches/gthumb-2-10/libgthumb/gth-file-list.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/gth-file-list.c	(original)
+++ branches/gthumb-2-10/libgthumb/gth-file-list.c	Wed Jan 16 18:58:19 2008
@@ -579,7 +579,7 @@
 
 	width = gdk_pixbuf_get_width (pixbuf);
 	height = gdk_pixbuf_get_height (pixbuf);
-	if (scale_keepping_ratio (&width, &height, icon_size, icon_size)) {
+	if (scale_keeping_ratio (&width, &height, icon_size, icon_size, FALSE)) {
 		GdkPixbuf *scaled;
 		scaled = gdk_pixbuf_scale_simple (pixbuf,
 						  width,

Modified: branches/gthumb-2-10/libgthumb/gth-file-view-list.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/gth-file-view-list.c	(original)
+++ branches/gthumb-2-10/libgthumb/gth-file-view-list.c	Wed Jan 16 18:58:19 2008
@@ -164,7 +164,7 @@
 
 	w = gdk_pixbuf_get_width (pixbuf);
 	h = gdk_pixbuf_get_height (pixbuf);
-	if (scale_keepping_ratio (&w, &h, max_image_size, max_image_size)) {
+	if (scale_keeping_ratio (&w, &h, max_image_size, max_image_size, FALSE)) {
 		GdkPixbuf *try_pixbuf;
 
 		/* look in the hash table. */

Modified: branches/gthumb-2-10/libgthumb/pixbuf-utils.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/pixbuf-utils.c	(original)
+++ branches/gthumb-2-10/libgthumb/pixbuf-utils.c	Wed Jan 16 18:58:19 2008
@@ -1304,10 +1304,11 @@
 
 
 gboolean
-scale_keepping_ratio (int *width,
-		      int *height,
-		      int  max_width,
-		      int  max_height)
+scale_keeping_ratio (int      *width,
+	             int      *height,
+		     int       max_width,
+		     int       max_height,
+		     gboolean  allow_upscaling)
 {
 	double   w = *width;
 	double   h = *height;
@@ -1317,7 +1318,7 @@
 	int      new_width, new_height;
 	gboolean modified;
 
-	if ((*width < max_width) && (*height < max_height))
+	if ((*width < max_width) && (*height < max_height) && !allow_upscaling)
 		return FALSE;
 
 	factor = MIN (max_w / w, max_h / h);

Modified: branches/gthumb-2-10/libgthumb/pixbuf-utils.h
==============================================================================
--- branches/gthumb-2-10/libgthumb/pixbuf-utils.h	(original)
+++ branches/gthumb-2-10/libgthumb/pixbuf-utils.h	Wed Jan 16 18:58:19 2008
@@ -56,10 +56,11 @@
 					       char           **keys,
 					       char           **values,
 					       GError         **error);
-gboolean   scale_keepping_ratio               (int             *width,
+gboolean   scale_keeping_ratio                (int             *width,
 					       int             *height,
 					       int              max_width,
-					       int              max_height);
+					       int              max_height,
+					       gboolean         allow_upscaling);
 GdkPixbuf* create_void_pixbuf                 (int              width,
 					       int              height);
 GdkPixbuf* _gdk_pixbuf_scale_simple_safe      (const GdkPixbuf *src,

Modified: branches/gthumb-2-10/libgthumb/print-callbacks.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/print-callbacks.c	(original)
+++ branches/gthumb-2-10/libgthumb/print-callbacks.c	Wed Jan 16 18:58:19 2008
@@ -2317,7 +2317,7 @@
 		thumb_w = image->pixbuf_width = gdk_pixbuf_get_width (pixbuf);
 		thumb_h = image->pixbuf_height = gdk_pixbuf_get_height (pixbuf);
 
-		if (scale_keepping_ratio (&thumb_w, &thumb_h, THUMB_SIZE, THUMB_SIZE))
+		if (scale_keeping_ratio (&thumb_w, &thumb_h, THUMB_SIZE, THUMB_SIZE, FALSE))
 			image->thumbnail = gdk_pixbuf_scale_simple (pixbuf,
 								    thumb_w,
 								    thumb_h,

Modified: branches/gthumb-2-10/libgthumb/thumb-loader.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/thumb-loader.c	(original)
+++ branches/gthumb-2-10/libgthumb/thumb-loader.c	Wed Jan 16 18:58:19 2008
@@ -532,9 +532,10 @@
 		 * scaled if necessary. */
 
 		/* Check whether to scale. */
-		modified = scale_keepping_ratio (&width, &height,
+		modified = scale_keeping_ratio (&width, &height,
 						 priv->cache_max_w,
-						 priv->cache_max_h);
+						 priv->cache_max_h,
+						 FALSE);
 		if (modified) {
 			g_object_unref (priv->pixbuf);
 			priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf,
@@ -564,7 +565,7 @@
 		}
 	} 
 	else {
-		modified = scale_keepping_ratio (&width, &height, priv->max_w, priv->max_h);
+		modified = scale_keeping_ratio (&width, &height, priv->max_w, priv->max_h, FALSE);
 		if (modified) {
 			g_object_unref (priv->pixbuf);
 			priv->pixbuf = gdk_pixbuf_scale_simple (pixbuf,

Modified: branches/gthumb-2-10/src/catalog-png-exporter.c
==============================================================================
--- branches/gthumb-2-10/src/catalog-png-exporter.c	(original)
+++ branches/gthumb-2-10/src/catalog-png-exporter.c	Wed Jan 16 18:58:19 2008
@@ -1461,9 +1461,10 @@
 		int w = gdk_pixbuf_get_width (pixbuf);
 		int h = gdk_pixbuf_get_height (pixbuf);
 
-		if (scale_keepping_ratio (&w, &h,
+		if (scale_keeping_ratio (&w, &h,
 					  ce->thumb_width,
-					  ce->thumb_height)) {
+					  ce->thumb_height,
+					  FALSE)) {
 			GdkPixbuf *scaled;
 			scaled = gdk_pixbuf_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR);
 			g_object_unref (idata->thumb);

Modified: branches/gthumb-2-10/src/catalog-web-exporter.c
==============================================================================
--- branches/gthumb-2-10/src/catalog-web-exporter.c	(original)
+++ branches/gthumb-2-10/src/catalog-web-exporter.c	Wed Jan 16 18:58:19 2008
@@ -1201,10 +1201,11 @@
 
 			max_size = gth_tag_get_var (ce, tag, "max_size");
 			if (max_size > 0)
-				scale_keepping_ratio (&image_width,
+				scale_keeping_ratio (&image_width,
 						      &image_height,
 						      max_size,
-						      max_size);
+						      max_size,
+						      FALSE);
 
 			image_src_relative = get_path_relative_to_uri (image_src, ce->location);
 			
@@ -2285,7 +2286,7 @@
 	if (ce->copy_images && ce->resize_images) {
 		int w = gdk_pixbuf_get_width (pixbuf);
 		int h = gdk_pixbuf_get_height (pixbuf);
-		if (scale_keepping_ratio (&w, &h, ce->resize_max_width, ce->resize_max_height)) {
+		if (scale_keeping_ratio (&w, &h, ce->resize_max_width, ce->resize_max_height, FALSE)) {
 			GdkPixbuf *scaled;
 			scaled = pixbuf_scale (pixbuf, w, h, GDK_INTERP_BILINEAR);
 			g_object_unref (idata->image);
@@ -2305,9 +2306,10 @@
 		int w = gdk_pixbuf_get_width (pixbuf);
 		int h = gdk_pixbuf_get_height (pixbuf);
 
-		if (scale_keepping_ratio (&w, &h,
+		if (scale_keeping_ratio (&w, &h,
 					  ce->preview_max_width,
-					  ce->preview_max_height)) {
+					  ce->preview_max_height,
+					  FALSE)) {
 			GdkPixbuf *scaled;
 			scaled = pixbuf_scale (pixbuf, w, h, GDK_INTERP_BILINEAR);
 			g_object_unref (idata->preview);
@@ -2336,9 +2338,10 @@
 		int w = gdk_pixbuf_get_width (pixbuf);
 		int h = gdk_pixbuf_get_height (pixbuf);
 
-		if (scale_keepping_ratio (&w, &h,
+		if (scale_keeping_ratio (&w, &h,
 					  ce->thumb_width,
-					  ce->thumb_height)) {
+					  ce->thumb_height,
+					  FALSE)) {
 			GdkPixbuf *scaled;
 			scaled = pixbuf_scale (pixbuf, w, h, GDK_INTERP_BILINEAR);
 			g_object_unref (idata->thumb);

Modified: branches/gthumb-2-10/src/dlg-brightness-contrast.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-brightness-contrast.c	(original)
+++ branches/gthumb-2-10/src/dlg-brightness-contrast.c	Wed Jan 16 18:58:19 2008
@@ -282,7 +282,7 @@
 
 	preview_width  = image_width;
 	preview_height = image_height;
-	scale_keepping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE);
+	scale_keeping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE, FALSE);
 
 	data->orig_pixbuf = gdk_pixbuf_scale_simple (image,
 						     preview_width, 

Modified: branches/gthumb-2-10/src/dlg-color-balance.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-color-balance.c	(original)
+++ branches/gthumb-2-10/src/dlg-color-balance.c	Wed Jan 16 18:58:19 2008
@@ -308,7 +308,7 @@
 
 	preview_width  = image_width;
 	preview_height = image_height;
-	scale_keepping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE);
+	scale_keeping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE, FALSE);
 
 	data->orig_pixbuf = gdk_pixbuf_scale_simple (image,
 						     preview_width, 

Modified: branches/gthumb-2-10/src/dlg-hue-saturation.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-hue-saturation.c	(original)
+++ branches/gthumb-2-10/src/dlg-hue-saturation.c	Wed Jan 16 18:58:19 2008
@@ -294,7 +294,7 @@
 
 	preview_width  = image_width;
 	preview_height = image_height;
-	scale_keepping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE);
+	scale_keeping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE, FALSE);
 
 	data->orig_pixbuf = gdk_pixbuf_scale_simple (image,
 						     preview_width, 

Modified: branches/gthumb-2-10/src/dlg-image-prop.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-image-prop.c	(original)
+++ branches/gthumb-2-10/src/dlg-image-prop.c	Wed Jan 16 18:58:19 2008
@@ -453,7 +453,7 @@
 		
 		width = gdk_pixbuf_get_width (pixbuf);
 		height = gdk_pixbuf_get_height (pixbuf);
-		scale_keepping_ratio (&width, &height, PREVIEW_SIZE, PREVIEW_SIZE); 
+		scale_keeping_ratio (&width, &height, PREVIEW_SIZE, PREVIEW_SIZE, FALSE);
 		
 		scaled = gdk_pixbuf_scale_simple (pixbuf, 
 						  width, 

Modified: branches/gthumb-2-10/src/dlg-jpegtran.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-jpegtran.c	(original)
+++ branches/gthumb-2-10/src/dlg-jpegtran.c	Wed Jan 16 18:58:19 2008
@@ -136,7 +136,7 @@
 
 	width = gdk_pixbuf_get_width (pixbuf);
 	height = gdk_pixbuf_get_height (pixbuf);
-	if (scale_keepping_ratio (&width, &height, max_width, max_height))
+	if (scale_keeping_ratio (&width, &height, max_width, max_height, FALSE))
 		result = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
 	else {
 		result = pixbuf;

Modified: branches/gthumb-2-10/src/dlg-posterize.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-posterize.c	(original)
+++ branches/gthumb-2-10/src/dlg-posterize.c	Wed Jan 16 18:58:19 2008
@@ -272,7 +272,7 @@
 
 	preview_width  = image_width;
 	preview_height = image_height;
-	scale_keepping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE);
+	scale_keeping_ratio (&preview_width, &preview_height, PREVIEW_SIZE, PREVIEW_SIZE, FALSE);
 
 	data->orig_pixbuf = gdk_pixbuf_scale_simple (image,
 						     preview_width, 

Modified: branches/gthumb-2-10/src/dlg-web-exporter.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-web-exporter.c	(original)
+++ branches/gthumb-2-10/src/dlg-web-exporter.c	Wed Jan 16 18:58:19 2008
@@ -936,7 +936,7 @@
 		    && ((image = gdk_pixbuf_new_from_file (filename, NULL)) != NULL)) {
 			int        w = gdk_pixbuf_get_width (image);
 			int        h = gdk_pixbuf_get_height (image);
-			if (scale_keepping_ratio (&w, &h, MAX_PREVIEW_SIZE, MAX_PREVIEW_SIZE)) {
+			if (scale_keeping_ratio (&w, &h, MAX_PREVIEW_SIZE, MAX_PREVIEW_SIZE, FALSE)) {
 				GdkPixbuf *tmp = image;
 				image = gdk_pixbuf_scale_simple (tmp, w, h, GDK_INTERP_BILINEAR);
 				g_object_unref (tmp);

Modified: branches/gthumb-2-10/src/main.c
==============================================================================
--- branches/gthumb-2-10/src/main.c	(original)
+++ branches/gthumb-2-10/src/main.c	Wed Jan 16 18:58:19 2008
@@ -951,7 +951,7 @@
 
 		w = gdk_pixbuf_get_width (icon_pixbuf[icon_name]);
 		h = gdk_pixbuf_get_height (icon_pixbuf[icon_name]);
-		if (scale_keepping_ratio (&w, &h, icon_size, icon_size))
+		if (scale_keeping_ratio (&w, &h, icon_size, icon_size, FALSE))
 			pixbuf = gdk_pixbuf_scale_simple (icon_pixbuf[icon_name],
 							  w,
 							  h,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]