[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46762] branches/soc-2011-tomato/source/ blender: mask: remove aspect arguments which are no longer needed.

Campbell Barton ideasman42 at gmail.com
Fri May 18 11:36:33 CEST 2012


Revision: 46762
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46762
Author:   campbellbarton
Date:     2012-05-18 09:36:32 +0000 (Fri, 18 May 2012)
Log Message:
-----------
mask: remove aspect arguments which are no longer needed.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
    branches/soc-2011-tomato/source/blender/editors/include/ED_mask.h
    branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c
    branches/soc-2011-tomato/source/blender/editors/mask/mask_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
    branches/soc-2011-tomato/source/blender/editors/transform/transform_conversions.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_mask_types.h

Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h	2012-05-18 09:33:50 UTC (rev 46761)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h	2012-05-18 09:36:32 UTC (rev 46762)
@@ -54,21 +54,20 @@
 struct MaskSpline *BKE_mask_spline_add(struct MaskShape *shape);
 int BKE_mask_spline_resolution(struct MaskSpline *spline);
 float *BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point);
-float *BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, float aspx,
-                                                     float aspy, int *tot_feather_point);
-float *BKE_mask_spline_feather_points(struct MaskSpline *spline, float aspx, float aspy, int *tot_feather_point);
+float *BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point);
+float *BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point);
 
 /* point */
 int BKE_mask_point_has_handle(struct MaskSplinePoint *point);
-void BKE_mask_point_handle(struct MaskSplinePoint *point, float aspx, float aspy, float handle[2]);
+void BKE_mask_point_handle(struct MaskSplinePoint *point, float handle[2]);
 void BKE_mask_point_set_handle(struct MaskSplinePoint *point, float loc[2], int keep_direction,
                                float aspx, float aspy, float orig_handle[2], float orig_vec[3][3]);
 float *BKE_mask_point_segment_diff(struct MaskSpline *spline, struct MaskSplinePoint *point, int *tot_diff_point);
 float *BKE_mask_point_segment_feather_diff(struct MaskSpline *spline, struct MaskSplinePoint *point,
-                                           float aspx, float aspy, int *tot_feather_point);
+                                           int *tot_feather_point);
 void BKE_mask_point_segment_co(struct MaskSpline *spline, struct MaskSplinePoint *point, float u, float co[2]);
 void BKE_mask_point_normal(struct MaskSpline *spline, struct MaskSplinePoint *point,
-                           float aspx, float aspy, float u, float n[2]);
+                           float u, float n[2]);
 float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *point, float u);
 struct MaskSplinePointUW *BKE_mask_point_sort_uw(struct MaskSplinePoint *point, struct MaskSplinePointUW *uw);
 void BKE_mask_point_add_uw(struct MaskSplinePoint *point, float u, float w);

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-05-18 09:33:50 UTC (rev 46761)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c	2012-05-18 09:36:32 UTC (rev 46762)
@@ -257,8 +257,7 @@
 	return diff_points;
 }
 
-float *BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, float aspx, float aspy,
-                                                     int *tot_feather_point)
+float *BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, int *tot_feather_point)
 {
 	float *feather, *fp;
 	int i, j, tot, resol = BKE_mask_spline_feather_resolution(spline);
@@ -274,7 +273,7 @@
 			float co[2], n[2];
 
 			BKE_mask_point_segment_co(spline, point, u, co);
-			BKE_mask_point_normal(spline, point, aspx, aspy, u, n);
+			BKE_mask_point_normal(spline, point, u, n);
 			weight = BKE_mask_point_weight(spline, point, u);
 
 			fp[0] = co[0] + n[0] * weight;
@@ -287,7 +286,7 @@
 	return feather;
 }
 
-float *BKE_mask_spline_feather_points(MaskSpline *spline, float aspx, float aspy, int *tot_feather_point)
+float *BKE_mask_spline_feather_points(MaskSpline *spline, int *tot_feather_point)
 {
 	int i, tot = 0;
 	float *feather, *fp;
@@ -308,7 +307,7 @@
 		float weight, n[2];
 		int j;
 
-		BKE_mask_point_normal(spline, point, aspx, aspy, 0.0f, n);
+		BKE_mask_point_normal(spline, point, 0.0f, n);
 		weight = BKE_mask_point_weight(spline, point, 0.0f);
 
 		fp[0] = bezt->vec[1][0] + n[0] * weight;
@@ -320,7 +319,7 @@
 			float co[2];
 
 			BKE_mask_point_segment_co(spline, point, u, co);
-			BKE_mask_point_normal(spline, point, aspx, aspy, u, n);
+			BKE_mask_point_normal(spline, point, u, n);
 			weight = BKE_mask_point_weight(spline, point, u);
 
 			fp[0] = co[0] + n[0] * weight;
@@ -344,17 +343,14 @@
 	return bezt->h1 == HD_ALIGN;
 }
 
-void BKE_mask_point_handle(MaskSplinePoint *point, float aspx, float aspy, float handle[2])
+void BKE_mask_point_handle(MaskSplinePoint *point, float handle[2])
 {
 	float vec[2];
 
 	sub_v2_v2v2(vec, point->bezt.vec[0], point->bezt.vec[1]);
 
-	vec[0] *= aspx;
-	vec[1] *= aspy;
-
-	handle[0] = (point->bezt.vec[1][0] * aspx + vec[1]) / aspx;
-	handle[1] = (point->bezt.vec[1][1] * aspy - vec[0]) / aspy;
+	handle[0] = (point->bezt.vec[1][0] + vec[1]);
+	handle[1] = (point->bezt.vec[1][1] - vec[0]);
 }
 
 void BKE_mask_point_set_handle(MaskSplinePoint *point, float loc[2], int keep_direction, float aspx, float aspy,
@@ -406,8 +402,7 @@
 	}
 }
 
-float *BKE_mask_point_segment_feather_diff(MaskSpline *spline, MaskSplinePoint *point, float aspx, float aspy,
-                                           int *tot_feather_point)
+float *BKE_mask_point_segment_feather_diff(MaskSpline *spline, MaskSplinePoint *point, int *tot_feather_point)
 {
 	float *feather, *fp;
 	int i, resol = BKE_mask_spline_feather_resolution(spline);
@@ -419,7 +414,7 @@
 		float co[2], n[2];
 
 		BKE_mask_point_segment_co(spline, point, u, co);
-		BKE_mask_point_normal(spline, point, aspx, aspy, u, n);
+		BKE_mask_point_normal(spline, point, u, n);
 		weight = BKE_mask_point_weight(spline, point, u);
 
 		fp[0] = co[0] + n[0] * weight;
@@ -493,7 +488,7 @@
 	interp_v2_v2v2(co, r0, r1, u);
 }
 
-void BKE_mask_point_normal(MaskSpline *spline, MaskSplinePoint *point, float aspx, float aspy, float u, float n[2])
+void BKE_mask_point_normal(MaskSpline *spline, MaskSplinePoint *point, float u, float n[2])
 {
 	BezTriple *bezt = &point->bezt, *next;
 	float q0[2], q1[2], q2[2], r0[2], r1[2], vec[2];
@@ -504,21 +499,15 @@
 		else
 			next = NULL;
 	}
-	else next = &((point + 1))->bezt;
+	else {
+		next = &((point + 1))->bezt;
+	}
 
 	if (!next) {
-		BKE_mask_point_handle(point, aspx, aspy, vec);
+		BKE_mask_point_handle(point, vec);
 
 		sub_v2_v2v2(n, vec, bezt->vec[1]);
-
-		n[0] *= aspx;
-		n[1] *= aspy;
-
 		normalize_v2(n);
-
-		n[0] /= aspx;
-		n[1] /= aspy;
-
 		return;
 	}
 
@@ -531,13 +520,10 @@
 
 	sub_v2_v2v2(vec, r1, r0);
 
-	n[0] = -vec[1] * aspy;
-	n[1] =  vec[0] * aspx;
+	n[0] = -vec[1];
+	n[1] =  vec[0];
 
 	normalize_v2(n);
-
-	n[0] /= aspx;
-	n[1] /= aspy;
 }
 
 float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, float u)

Modified: branches/soc-2011-tomato/source/blender/editors/include/ED_mask.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/include/ED_mask.h	2012-05-18 09:33:50 UTC (rev 46761)
+++ branches/soc-2011-tomato/source/blender/editors/include/ED_mask.h	2012-05-18 09:36:32 UTC (rev 46762)
@@ -39,6 +39,6 @@
 void ED_operatormacros_mask(void);
 
 /* mask_draw.c */
-void ED_mask_draw(bContext *C, int width, int height, float zoomx, float zoomy);
+void ED_mask_draw(const bContext *C);
 
 #endif /* ED_TEXT_H */

Modified: branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c	2012-05-18 09:33:50 UTC (rev 46761)
+++ branches/soc-2011-tomato/source/blender/editors/mask/mask_draw.c	2012-05-18 09:36:32 UTC (rev 46762)
@@ -49,12 +49,6 @@
 
 #include "mask_intern.h"  /* own include */
 
-typedef struct PixelSpaceContext {
-	int width, height;
-	float zoomx, zoomy;
-	float aspx, aspy;
-} PixelSpaceContext;
-
 static void set_spline_color(MaskShape *shape, MaskSpline *spline)
 {
 	if (spline->flag & SELECT) {
@@ -69,7 +63,7 @@
 }
 
 /* return non-zero if spline is selected */
-static void draw_spline_points(MaskShape *shape, MaskSpline *spline, PixelSpaceContext *pixelspace)
+static void draw_spline_points(MaskShape *shape, MaskSpline *spline)
 {
 	int i, hsize, tot_feather_point;
 	float *feather_points, *fp;
@@ -82,7 +76,7 @@
 	glPointSize(hsize);
 
 	/* feather points */
-	feather_points = fp = BKE_mask_spline_feather_points(spline, pixelspace->aspx, pixelspace->aspy, &tot_feather_point);
+	feather_points = fp = BKE_mask_spline_feather_points(spline, &tot_feather_point);
 	for (i = 0; i < spline->tot_point; i++) {
 		int j;
 		MaskSplinePoint *point = &spline->points[i];
@@ -119,12 +113,11 @@
 	/* control points */
 	for (i = 0; i < spline->tot_point; i++) {
 		MaskSplinePoint *point = &spline->points[i];
-		BezTriple *bezt = &point->bezt;
-		float vert[2], handle[2];
+		float handle[2];
+		float *vert = point->bezt.vec[1];
 		int has_handle = BKE_mask_point_has_handle(point);
 
-		copy_v2_v2(vert, bezt->vec[1]);
-		BKE_mask_point_handle(point, pixelspace->aspx, pixelspace->aspy, handle);
+		BKE_mask_point_handle(point, handle);
 
 		/* draw handle segment */
 		if (has_handle) {
@@ -196,7 +189,7 @@
 	glDisable(GL_LINE_STIPPLE);
 }
 
-static void draw_spline_curve(MaskShape *shape, MaskSpline *spline, PixelSpaceContext *pixelspace)
+static void draw_spline_curve(MaskShape *shape, MaskSpline *spline)
 {
 	float *diff_points, *feather_points;
 	int tot_diff_point, tot_feather_point;
@@ -206,8 +199,7 @@
 	if (!diff_points)
 		return;
 
-	feather_points = BKE_mask_spline_feather_differentiated_points(spline, pixelspace->aspx, pixelspace->aspy,
-	                                                               &tot_feather_point);
+	feather_points = BKE_mask_spline_feather_differentiated_points(spline, &tot_feather_point);
 
 	/* draw feather */
 	if (spline->flag & SELECT)
@@ -224,7 +216,7 @@
 	MEM_freeN(feather_points);
 }
 
-static void draw_shapes(Mask *mask, PixelSpaceContext *pixelspace)
+static void draw_shapes(Mask *mask)
 {
 	MaskShape *shape = mask->shapes.first;
 
@@ -233,10 +225,10 @@
 
 		while (spline) {
 			/* draw curve itself first... */
-			draw_spline_curve(shape, spline, pixelspace);
+			draw_spline_curve(shape, spline);
 
 			/* ...and then handles over the curve so they're nicely visible */
-			draw_spline_points(shape, spline, pixelspace);
+			draw_spline_points(shape, spline);
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list