[Rawstudio-commit] r3186 - trunk/plugins/resample

Klaus Post klauspost at gmail.com
Fri Feb 12 23:43:27 CET 2010


Author: post
Date: 2010-02-12 23:43:27 +0100 (Fri, 12 Feb 2010)
New Revision: 3186

Modified:
   trunk/plugins/resample/resample.c
Log:
Fix scale not being reported correctly when exporting using fixed sizes.

Modified: trunk/plugins/resample/resample.c
===================================================================
--- trunk/plugins/resample/resample.c	2010-02-12 22:41:07 UTC (rev 3185)
+++ trunk/plugins/resample/resample.c	2010-02-12 22:43:27 UTC (rev 3186)
@@ -231,7 +231,19 @@
 	{
 		new_width = resample->target_width;
 		new_height = resample->target_height;
-		resample->scale = 1.0;
+		if (RS_FILTER(resample)->previous)
+		{
+			const gint previous_width = rs_filter_get_width(RS_FILTER(resample)->previous);
+			const gint previous_height = rs_filter_get_height(RS_FILTER(resample)->previous);
+			if (previous_width > 0 && previous_height > 0)
+				resample->scale = MIN((gfloat)new_width / previous_width, (gfloat)new_height / previous_height);
+			else
+				resample->scale = 1.0f;
+		}
+		else
+		{
+			resample->scale = 1.0f;
+		}
 	}
 
 	if ((new_width != resample->new_width) || (new_height != resample->new_height))




More information about the Rawstudio-commit mailing list