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

Anders Brander anders at brander.dk
Mon Apr 27 20:04:08 CEST 2009


Author: abrander
Date: 2009-04-27 20:04:08 +0200 (Mon, 27 Apr 2009)
New Revision: 2403

Modified:
   trunk/plugins/resample/resample.c
Log:
Now RSResample default to no transform.

Modified: trunk/plugins/resample/resample.c
===================================================================
--- trunk/plugins/resample/resample.c	2009-04-27 17:47:06 UTC (rev 2402)
+++ trunk/plugins/resample/resample.c	2009-04-27 18:04:08 UTC (rev 2403)
@@ -112,8 +112,8 @@
 static void
 rs_resample_init(RSResample *resample)
 {
-	resample->new_width = 400;
-	resample->new_height = 400;
+	resample->new_width = -1;
+	resample->new_height = -1;
 }
 
 static void
@@ -196,6 +196,10 @@
 	if (!RS_IS_IMAGE16(input))
 		return input;
 
+	/* Return the input, if the new size is uninitialized */
+	if ((resample->new_width == -1) || (resample->new_height == -1))
+		return input;
+
 	/* Simply return the input, if we don't scale */
 	if ((input_width == resample->new_width) && (input_height == resample->new_height))
 		return input;
@@ -283,7 +287,10 @@
 {
 	RSResample *resample = RS_RESAMPLE(filter);
 
-	return resample->new_width;
+	if (resample->new_width == -1)
+		return rs_filter_get_width(filter->previous);
+	else
+		return resample->new_width;
 }
 
 static gint
@@ -291,7 +298,10 @@
 {
 	RSResample *resample = RS_RESAMPLE(filter);
 
-	return resample->new_height;
+	if (resample->new_height == -1)
+		return rs_filter_get_width(filter->previous);
+	else
+		return resample->new_height;
 }
 
 static guint




More information about the Rawstudio-commit mailing list