[gimp] app: Fix couple of bugs in smooth code



commit 1cf5295d2e3b9bfa9b82d933a68d5f2a491928cd
Author: Alexia Death <alexiadeath gmail com>
Date:   Sun Feb 6 00:17:32 2011 +0200

    app: Fix couple of bugs in smooth code

 app/paint/gimppaintcore.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index 790e710..6a89266 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -1263,9 +1263,15 @@ gimp_paint_core_smooth_coords (GimpPaintCore    *core,
                                GimpPaintOptions *paint_options,
                                GimpCoords       *coords)
 {
+  
   GimpSmoothingOptions *smoothing_options = paint_options->smoothing_options;
   GArray               *history           = core->stroke_buffer;
 
+  g_return_if_fail(GIMP_IS_PAINT_CORE(core));
+
+  if (core->stroke_buffer == NULL)
+   return; /*Paint core has not initalized yet*/
+
   if (smoothing_options->use_smoothing &&
       smoothing_options->smoothing_quality > 0)
     {
@@ -1279,6 +1285,9 @@ gimp_paint_core_smooth_coords (GimpPaintCore    *core,
 
       g_array_append_val (history, *coords);
 
+      if (history->len < 2)
+        return; /*Just dont bother, nothing to do*/
+
       coords->x = coords->y = 0.0;
 
       length = MIN (smoothing_options->smoothing_quality, history->len);



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