[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49562] trunk/blender/source/blender/ blenkernel: minor improvements to last commit
Campbell Barton
ideasman42 at gmail.com
Sat Aug 4 22:22:43 CEST 2012
Revision: 49562
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49562
Author: campbellbarton
Date: 2012-08-04 20:22:43 +0000 (Sat, 04 Aug 2012)
Log Message:
-----------
minor improvements to last commit
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_mask.h
trunk/blender/source/blender/blenkernel/intern/mask.c
Modified: trunk/blender/source/blender/blenkernel/BKE_mask.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_mask.h 2012-08-04 20:17:22 UTC (rev 49561)
+++ trunk/blender/source/blender/blenkernel/BKE_mask.h 2012-08-04 20:22:43 UTC (rev 49562)
@@ -67,13 +67,13 @@
unsigned int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height);
unsigned int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height);
-int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const int resol);
+int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const unsigned int resol);
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2];
float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point))[2];
float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, int *tot_diff_point,
- const int resol))[2];
+ const unsigned int resol))[2];
float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2];
float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, int *tot_feather_point,
const unsigned int resol, const int do_collapse))[2];
Modified: trunk/blender/source/blender/blenkernel/intern/mask.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask.c 2012-08-04 20:17:22 UTC (rev 49561)
+++ trunk/blender/source/blender/blenkernel/intern/mask.c 2012-08-04 20:22:43 UTC (rev 49562)
@@ -304,14 +304,7 @@
}
}
- if (resol > MASK_RESOL_MAX) {
- resol = MASK_RESOL_MAX;
- }
- else if (resol == 0) {
- return 1;
- }
-
- return resol;
+ return CLAMPIS(resol, 1, MASK_RESOL_MAX);
}
unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height)
@@ -353,36 +346,22 @@
resol += max_jump / max_segment;
- if (resol > MASK_RESOL_MAX) {
- resol = MASK_RESOL_MAX;
- }
- else if (resol == 0) {
- return 1;
- }
-
- return resol;
+ return CLAMPIS(resol, 1, MASK_RESOL_MAX);
}
-int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const int resol)
+int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const unsigned int resol)
{
- int len;
-
- /* count */
- len = (spline->tot_point - 1) * resol;
-
if (spline->flag & MASK_SPLINE_CYCLIC) {
- len += resol;
+ return spline->tot_point * resol;
}
else {
- len++;
+ return ((spline->tot_point - 1) * resol) + 1;
}
-
- return len;
}
float (*BKE_mask_spline_differentiate_with_resolution_ex(MaskSpline *spline,
int *tot_diff_point,
- const int resol
+ const unsigned int resol
))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
@@ -443,7 +422,7 @@
int *tot_diff_point
))[2]
{
- int resol = BKE_mask_spline_resolution(spline, width, height);
+ int unsigned resol = BKE_mask_spline_resolution(spline, width, height);
return BKE_mask_spline_differentiate_with_resolution_ex(spline, tot_diff_point, resol);
}
More information about the Bf-blender-cvs
mailing list