[Bf-blender-cvs] [45881003f0e] blender2.8: GP: Remove old simplify code

Antonioya noreply at git.blender.org
Thu Oct 11 19:17:03 CEST 2018


Commit: 45881003f0efc14e50a055c7b5c3feec1f2b890c
Author: Antonioya
Date:   Thu Oct 11 19:16:55 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB45881003f0efc14e50a055c7b5c3feec1f2b890c

GP: Remove old simplify code

The simplify is controlled by brush and thsi function is not used.

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

M	source/blender/editors/gpencil/gpencil_paint.c

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 85479de7a77..88a47692238 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -833,81 +833,6 @@ static short gp_stroke_addpoint(
 	return GP_STROKEADD_INVALID;
 }
 
-/* simplify a stroke (in buffer) before storing it
- *	- applies a reverse Chaikin filter
- *	- code adapted from etch-a-ton branch
- */
-static void gp_stroke_simplify(tGPsdata *p)
-{
-	bGPdata *gpd = p->gpd;
-	tGPspoint *old_points = (tGPspoint *)gpd->runtime.sbuffer;
-	short num_points = gpd->runtime.sbuffer_size;
-	short flag = gpd->runtime.sbuffer_sflag;
-	short i, j;
-
-	/* only simplify if simplification is enabled, and we're not doing a straight line */
-	if (!(U.gp_settings & GP_PAINT_DOSIMPLIFY) || (p->paintmode == GP_PAINTMODE_DRAW_STRAIGHT))
-		return;
-
-	/* don't simplify if less than 4 points in buffer */
-	if ((num_points <= 4) || (old_points == NULL))
-		return;
-
-	/* clear buffer (but don't free mem yet) so that we can write to it
-	 *	- firstly set sbuffer to NULL, so a new one is allocated
-	 *	- secondly, reset flag after, as it gets cleared auto
-	 */
-	gpd->runtime.sbuffer = NULL;
-	gp_session_validatebuffer(p);
-	gpd->runtime.sbuffer_sflag = flag;
-
-	/* macro used in loop to get position of new point
-	 *	- used due to the mixture of datatypes in use here
-	 */
-#define GP_SIMPLIFY_AVPOINT(offs, sfac) \
-	{ \
-		co[0] += (float)(old_points[offs].x * sfac); \
-		co[1] += (float)(old_points[offs].y * sfac); \
-		pressure += old_points[offs].pressure * sfac; \
-		time += old_points[offs].time * sfac; \
-	} (void)0
-
-	 /* XXX Here too, do not lose start and end points! */
-	gp_stroke_addpoint(p, &old_points->x, old_points->pressure, p->inittime + (double)old_points->time);
-	for (i = 0, j = 0; i < num_points; i++) {
-		if (i - j == 3) {
-			float co[2], pressure, time;
-			int mco[2];
-
-			/* initialize values */
-			co[0] = 0.0f;
-			co[1] = 0.0f;
-			pressure = 0.0f;
-			time = 0.0f;
-
-			/* using macro, calculate new point */
-			GP_SIMPLIFY_AVPOINT(j, -0.25f);
-			GP_SIMPLIFY_AVPOINT(j + 1, 0.75f);
-			GP_SIMPLIFY_AVPOINT(j + 2, 0.75f);
-			GP_SIMPLIFY_AVPOINT(j + 3, -0.25f);
-
-			/* set values for adding */
-			mco[0] = (int)co[0];
-			mco[1] = (int)co[1];
-
-			/* ignore return values on this... assume to be ok for now */
-			gp_stroke_addpoint(p, mco, pressure, p->inittime + (double)time);
-
-			j += 2;
-		}
-	}
-	gp_stroke_addpoint(p, &old_points[num_points - 1].x, old_points[num_points - 1].pressure,
-		p->inittime + (double)old_points[num_points - 1].time);
-
-	/* free old buffer */
-	MEM_freeN(old_points);
-}
-
 /* make a new stroke from the buffer data */
 static void gp_stroke_newfrombuffer(tGPsdata *p)
 {
@@ -2201,9 +2126,6 @@ static void gp_paint_strokeend(tGPsdata *p)
 
 	/* check if doing eraser or not */
 	if ((p->gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
-		/* simplify stroke before transferring? */
-		gp_stroke_simplify(p);
-
 		/* transfer stroke to frame */
 		gp_stroke_newfrombuffer(p);
 	}



More information about the Bf-blender-cvs mailing list