Author: post
Date: 2010-11-14 12:33:25 +0100 (Sun, 14 Nov 2010)
New Revision: 3620

Modified:
   trunk/plugins/crop/crop.c
Log:
Make sure crop doesn't invalidate the filter chain, if crop hasn't actually 
changed.

Modified: trunk/plugins/crop/crop.c
===================================================================
--- trunk/plugins/crop/crop.c   2010-11-14 10:58:19 UTC (rev 3619)
+++ trunk/plugins/crop/crop.c   2010-11-14 11:33:25 UTC (rev 3620)
@@ -195,37 +195,63 @@
        RSCrop *crop = RS_CROP(object);
        RSFilter *filter = RS_FILTER(crop);
        RS_RECT *rect;
+       int n;
 
        switch (property_id)
        {
                case PROP_RECTANGLE:
                        rect = g_value_get_pointer(value);
                        if (rect)
-                               crop->target = *rect;
+                       {
+                               if (crop->target.x1 != rect->x1 || 
crop->target.x2 != rect->x2 || crop->target.y1 != rect->y1 || crop->target.y2 
!= rect->y2)
+                               {
+                                       crop->target = *rect;
+                                       rs_filter_changed(filter, 
RS_FILTER_CHANGED_DIMENSION);
+                               }
+                       }
                        else
                        {
-                               crop->target.x1 = 0;
-                               crop->target.x2 = 65535;
-                               crop->target.y1 = 0;
-                               crop->target.y2 = 65535;
+                               if (crop->target.x1 != 0 || crop->target.x2 != 
65535 || crop->target.y1 != 0 || crop->target.y2 != 65535)
+                               {
+                                       crop->target.x1 = 0;
+                                       crop->target.x2 = 65535;
+                                       crop->target.y1 = 0;
+                                       crop->target.y2 = 65535;
+                                       rs_filter_changed(filter, 
RS_FILTER_CHANGED_DIMENSION);
+                               }
                        }
-                       rs_filter_changed(filter, RS_FILTER_CHANGED_DIMENSION);
                        break;
                case PROP_X1:
-                       crop->target.x1 = g_value_get_int(value);
-                       rs_filter_changed(filter, RS_FILTER_CHANGED_DIMENSION);
+                       n = g_value_get_int(value);
+                       if (n != crop->target.x1)
+                       {
+                               rs_filter_changed(filter, 
RS_FILTER_CHANGED_DIMENSION);
+                               crop->target.x1 = n;
+                       }
                        break;
                case PROP_Y1:
-                       crop->target.y1 = g_value_get_int(value);
-                       rs_filter_changed(filter, RS_FILTER_CHANGED_DIMENSION);
+                       n = g_value_get_int(value);
+                       if (n != crop->target.y1)
+                       {
+                               rs_filter_changed(filter, 
RS_FILTER_CHANGED_DIMENSION);
+                               crop->target.y1 = n;
+                       }
                        break;
                case PROP_X2:
-                       crop->target.x2 = g_value_get_int(value);
-                       rs_filter_changed(filter, RS_FILTER_CHANGED_DIMENSION);
+                       n = g_value_get_int(value);
+                       if (n != crop->target.x2)
+                       {
+                               rs_filter_changed(filter, 
RS_FILTER_CHANGED_DIMENSION);
+                               crop->target.x2 = n;
+                       }
                        break;
                case PROP_Y2:
-                       crop->target.y2 = g_value_get_int(value);
-                       rs_filter_changed(filter, RS_FILTER_CHANGED_DIMENSION);
+                       n = g_value_get_int(value);
+                       if (n != crop->target.y2)
+                       {
+                               rs_filter_changed(filter, 
RS_FILTER_CHANGED_DIMENSION);
+                               crop->target.y2 = n;
+                       }
                        break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, 
pspec);


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to