Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-05 10:54:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-05 10:54:18 +0400
commita0f5e200cc9f83c4a276c0978e136d4d7c3193a9 (patch)
tree79af9258a9c8fb13102bead24b7ce71f6a5041ca /source
parent06556a92e5ba0b0d541792e1ac2b84eaf59998b8 (diff)
fix for possible uninitialized pointer use in mask rasterize and remove some dead code.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/mask.c86
1 files changed, 41 insertions, 45 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 870a84df66a..9c2955e9118 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1972,15 +1972,6 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
/* temp blending buffer */
const int buffer_size = width * height;
float *buffer_tmp = MEM_mallocN(sizeof(float) * buffer_size, __func__);
- float max_dseg_len = 0.0f;
-
- if (width >= height) {
- max_dseg_len = (float)(width);
- }
- else {
- max_dseg_len = (float)(height);
- }
- max_dseg_len = 1.0f / max_dseg_len;
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
@@ -1999,51 +1990,56 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
float (*diff_feather_points)[2];
int tot_diff_feather_points;
- diff_points = BKE_mask_spline_differentiate_with_resolution(spline, width, height, &tot_diff_point);
+ diff_points = BKE_mask_spline_differentiate_with_resolution(spline, width, height,
+ &tot_diff_point);
+
if (tot_diff_point) {
diff_feather_points =
BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height,
&tot_diff_feather_points);
- }
- /* TODO, make this optional! */
- if (width != height) {
- float *fp;
- float *ffp;
- int i;
- float asp;
-
- if (width < height) {
- fp = &diff_points[0][0];
- ffp = &diff_feather_points[0][0];
- asp = (float)width / (float)height;
- }
- else {
- fp = &diff_points[0][1];
- ffp = &diff_feather_points[0][1];
- asp = (float)height / (float)width;
- }
+ /* TODO, make this optional! */
+ if (width != height) {
+ float *fp;
+ float *ffp;
+ int i;
+ float asp;
+
+ if (width < height) {
+ fp = &diff_points[0][0];
+ ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL;
+ asp = (float)width / (float)height;
+ }
+ else {
+ fp = &diff_points[0][1];
+ ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL;
+ asp = (float)height / (float)width;
+ }
- for (i = 0; i < tot_diff_point; i++, fp += 2) {
- (*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
- }
- for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
- (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
- }
- }
+ for (i = 0; i < tot_diff_point; i++, fp += 2) {
+ (*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
+ }
- if (tot_diff_point) {
- PLX_raskterize((float (*)[2])diff_points, tot_diff_point,
- buffer_tmp, width, height);
-
- if (tot_diff_feather_points) {
- PLX_raskterize_feather((float (*)[2])diff_points, tot_diff_point,
- (float (*)[2])diff_feather_points, tot_diff_feather_points,
- buffer_tmp, width, height);
- MEM_freeN(diff_feather_points);
+ if (tot_diff_feather_points) {
+ for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
+ (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
+ }
+ }
}
- MEM_freeN(diff_points);
+ if (tot_diff_point) {
+ PLX_raskterize(diff_points, tot_diff_point,
+ buffer_tmp, width, height);
+
+ if (tot_diff_feather_points) {
+ PLX_raskterize_feather(diff_points, tot_diff_point,
+ diff_feather_points, tot_diff_feather_points,
+ buffer_tmp, width, height);
+ MEM_freeN(diff_feather_points);
+ }
+
+ MEM_freeN(diff_points);
+ }
}
}