From d7b314d13f3069958d28fdfa63e9b8b4adf48d6b Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Thu, 29 Jul 2004 12:55:46 +0000 Subject: [PATCH] converted a multiple if into a nested one. * plug-ins/gimpressionist/repaint.c: converted a multiple if into a nested one. --- ChangeLog | 5 ++++ plug-ins/gimpressionist/repaint.c | 42 ++++++++++++++++++------------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9bfa05cf3c..ad1215ec6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-07-29 Shlomi Fish + + * plug-ins/gimpressionist/repaint.c: converted a multiple if into + a nested one. + 2004-07-29 Sven Neumann * app/core/core-enums.h: removed enums GimpImageType and diff --git a/plug-ins/gimpressionist/repaint.c b/plug-ins/gimpressionist/repaint.c index 04742e2f2d..f07f437b13 100644 --- a/plug-ins/gimpressionist/repaint.c +++ b/plug-ins/gimpressionist/repaint.c @@ -725,23 +725,31 @@ void repaint(ppm_t *p, ppm_t *a) } /* Handle Adaptive selections */ - /* TODO : Nest the ifs here. */ - if((runningvals.orienttype == ORIENTATION_ADAPTIVE) && - (runningvals.sizetype == SIZE_TYPE_ADAPTIVE)) - { - n = choose_best_brush(p, a, tx-maxbrushwidth/2, ty-maxbrushheight/2, - brushes, num_brushes, brushes_sum, 0, 1); - } else if(runningvals.orienttype == ORIENTATION_ADAPTIVE) { - int st = sn * runningvals.orientnum; - n = choose_best_brush(p, a, tx-maxbrushwidth/2, ty-maxbrushheight/2, - brushes, st+runningvals.orientnum, brushes_sum, st, 1); - } else if(runningvals.sizetype == SIZE_TYPE_ADAPTIVE) { - n = choose_best_brush(p, a, tx-maxbrushwidth/2, ty-maxbrushheight/2, - brushes, num_brushes, brushes_sum, on, runningvals.orientnum); - } else { - n = sn * runningvals.orientnum + on; - } - + if (runningvals.orienttype == ORIENTATION_ADAPTIVE) + { + if (runningvals.sizetype == SIZE_TYPE_ADAPTIVE) + n = choose_best_brush (p, a, tx-maxbrushwidth/2, + ty-maxbrushheight/2, brushes, + num_brushes, brushes_sum, 0, 1); + else + { + int st = sn * runningvals.orientnum; + n = choose_best_brush (p, a, tx-maxbrushwidth/2, + ty-maxbrushheight/2, brushes, + st+runningvals.orientnum, brushes_sum, + st, 1); + } + } + else + { + if (runningvals.sizetype == SIZE_TYPE_ADAPTIVE) + n = choose_best_brush (p, a, tx-maxbrushwidth/2, + ty-maxbrushheight/2, brushes, + num_brushes, brushes_sum, + on, runningvals.orientnum); + else + n = sn * runningvals.orientnum + on; + } /* Should never happen, but hey... */ if(n < 0) n = 0; else if(n >= num_brushes) n = num_brushes - 1;