[Bf-blender-cvs] [3912e4439a4] soc-2019-npr: Cleanup: Replace if else if, by Switch

Antonioya noreply at git.blender.org
Fri Jul 19 10:18:57 CEST 2019


Commit: 3912e4439a48afab13e8e0aaf48a39a32dd33c6e
Author: Antonioya
Date:   Fri Jul 19 10:18:51 2019 +0200
Branches: soc-2019-npr
https://developer.blender.org/rB3912e4439a48afab13e8e0aaf48a39a32dd33c6e

Cleanup: Replace if else if, by Switch

===================================================================

M	source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c

===================================================================

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
index 615850498a9..d67c7c09192 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
@@ -74,17 +74,25 @@ static void deformStroke(GpencilModifierData *md,
     return;
   }
 
-  if (mmd->mode == GP_SIMPLIFY_FIXED) {
-    for (int i = 0; i < mmd->step; i++) {
-      BKE_gpencil_simplify_fixed(gps);
+  /* Select simplification mode. */
+  switch (mmd->mode) {
+    case GP_SIMPLIFY_FIXED: {
+      for (int i = 0; i < mmd->step; i++) {
+        BKE_gpencil_simplify_fixed(gps);
+      }
+      break;
     }
-  }
-  else if (mmd->mode == GP_SIMPLIFY_ADAPTIVE) {
-    /* simplify stroke using Ramer-Douglas-Peucker algorithm */
-    BKE_gpencil_simplify_stroke(gps, mmd->factor);
-  }
-  else if (mmd->mode == GP_SIMPLIFY_SAMPLE) {
-    BKE_gpencil_sample_stroke(gps, mmd->length);
+    case GP_SIMPLIFY_ADAPTIVE: {
+      /* simplify stroke using Ramer-Douglas-Peucker algorithm */
+      BKE_gpencil_simplify_stroke(gps, mmd->factor);
+      break;
+    }
+    case GP_SIMPLIFY_SAMPLE: {
+      BKE_gpencil_sample_stroke(gps, mmd->length);
+      break;
+    }
+    default:
+      break;
   }
 }



More information about the Bf-blender-cvs mailing list