[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51547] trunk/blender/source/blender: use min_ max_ functions in more places.
Campbell Barton
ideasman42 at gmail.com
Tue Oct 23 18:22:00 CEST 2012
Revision: 51547
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51547
Author: campbellbarton
Date: 2012-10-23 16:21:55 +0000 (Tue, 23 Oct 2012)
Log Message:
-----------
use min_ max_ functions in more places.
also fix minor error in MOD decimate when the modifier did nothing the reported face count would be wrong.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/action.c
trunk/blender/source/blender/blenkernel/intern/mask_evaluate.c
trunk/blender/source/blender/blenkernel/intern/sequencer.c
trunk/blender/source/blender/blenkernel/intern/tracking.c
trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c
trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_CropOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
trunk/blender/source/blender/editors/mask/mask_select.c
trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
trunk/blender/source/blender/editors/object/object_vgroup.c
trunk/blender/source/blender/editors/render/render_preview.c
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
trunk/blender/source/blender/editors/space_console/console_ops.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
trunk/blender/source/blender/editors/space_view3d/view3d_buttons.c
trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
trunk/blender/source/blender/modifiers/intern/MOD_decimate.c
trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
trunk/blender/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/blenkernel/intern/action.c 2012-10-23 16:21:55 UTC (rev 51547)
@@ -906,8 +906,8 @@
calc_fcurve_range(fcu, &nmin, &nmax, FALSE, TRUE);
/* compare to the running tally */
- min = MIN2(min, nmin);
- max = MAX2(max, nmax);
+ min = min_ff(min, nmin);
+ max = max_ff(max, nmax);
foundvert = 1;
}
@@ -925,10 +925,10 @@
FMod_Limits *fmd = (FMod_Limits *)fcm->data;
if (fmd->flag & FCM_LIMIT_XMIN) {
- min = MIN2(min, fmd->rect.xmin);
+ min = min_ff(min, fmd->rect.xmin);
}
if (fmd->flag & FCM_LIMIT_XMAX) {
- max = MAX2(max, fmd->rect.xmax);
+ max = max_ff(max, fmd->rect.xmax);
}
}
break;
Modified: trunk/blender/source/blender/blenkernel/intern/mask_evaluate.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask_evaluate.c 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/blenkernel/intern/mask_evaluate.c 2012-10-23 16:21:55 UTC (rev 51547)
@@ -131,7 +131,7 @@
if (u_diff > FLT_EPSILON) {
float jump = fabsf(w_diff / u_diff);
- max_jump = MAX2(max_jump, jump);
+ max_jump = max_ff(max_jump, jump);
}
prev_u = point->uw[j].u;
Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c 2012-10-23 16:21:55 UTC (rev 51547)
@@ -2826,7 +2826,7 @@
count = BLI_countlist(&ed->metastack);
if ((chanshown < 0) && (count > 0)) {
- count = MAX2(count + chanshown, 0);
+ count = max_ii(count + chanshown, 0);
seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep;
}
else {
@@ -3458,7 +3458,7 @@
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->machine == orig_machine)
- new_frame = MAX2(new_frame, seq->enddisp);
+ new_frame = max_ii(new_frame, seq->enddisp);
}
test->machine = orig_machine;
@@ -3483,10 +3483,10 @@
for (seq_other = seqbasep->first; seq_other; seq_other = seq_other->next) {
if (!seq_other->tmp && seq_overlap(seq, seq_other)) {
if (dir == 'L') {
- offset = MIN2(offset, seq_other->startdisp - seq->enddisp);
+ offset = min_ii(offset, seq_other->startdisp - seq->enddisp);
}
else {
- offset = MAX2(offset, seq_other->enddisp - seq->startdisp);
+ offset = max_ii(offset, seq_other->enddisp - seq->startdisp);
}
}
}
Modified: trunk/blender/source/blender/blenkernel/intern/tracking.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/tracking.c 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/blenkernel/intern/tracking.c 2012-10-23 16:21:55 UTC (rev 51547)
@@ -221,7 +221,7 @@
float viewfac, pixsize, left, right, bottom, top, clipsta, clipend;
float winmat[4][4];
float ycor = 1.0f / tracking->camera.pixel_aspect;
- float shiftx, shifty, winside = MAX2(winx, winy);
+ float shiftx, shifty, winside = (float)min_ii(winx, winy);
BKE_tracking_camera_shift_get(tracking, winx, winy, &shiftx, &shifty);
@@ -2848,10 +2848,10 @@
}
if (first < track->markersnr - 1)
- sfra = MIN2(sfra, first_marker->framenr);
+ sfra = min_ii(sfra, first_marker->framenr);
if (last >= 0)
- efra = MAX2(efra, last_marker->framenr);
+ efra = max_ii(efra, last_marker->framenr);
tracks_map_insert(context->tracks_map, track, NULL);
@@ -3198,8 +3198,8 @@
if (track->flag & TRACK_USE_2D_STAB ||
((stab->flag & TRACKING_STABILIZE_ROTATION) && track == stab->rot_track))
{
- sfra = MIN2(sfra, track->markers[0].framenr);
- efra = MAX2(efra, track->markers[track->markersnr - 1].framenr);
+ sfra = min_ii(sfra, track->markers[0].framenr);
+ efra = max_ii(efra, track->markers[track->markersnr - 1].framenr);
}
track = track->next;
@@ -3643,7 +3643,7 @@
channel->segments[2 * segment] = start_marker->framenr;
channel->segments[2 * segment + 1] = start_marker->framenr + len;
- channel->max_segment = MAX2(channel->max_segment, len);
+ channel->max_segment = max_ii(channel->max_segment, len);
segment++;
}
Modified: trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c 2012-10-23 16:21:55 UTC (rev 51547)
@@ -810,7 +810,7 @@
/* tree epsilon must be >= FLT_EPSILON
* so that tangent rays can still hit a bounding volume..
* this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces */
- epsilon = MAX2(FLT_EPSILON, epsilon);
+ epsilon = max_ff(FLT_EPSILON, epsilon);
if (tree) {
tree->epsilon = epsilon;
@@ -1089,7 +1089,7 @@
data[j] = (BVHOverlapData *)MEM_callocN(sizeof(BVHOverlapData), "BVHOverlapData");
/* init BVHOverlapData */
- data[j]->overlap = (BVHTreeOverlap *)malloc(sizeof(BVHTreeOverlap) * MAX2(tree1->totleaf, tree2->totleaf));
+ data[j]->overlap = (BVHTreeOverlap *)malloc(sizeof(BVHTreeOverlap) * max_ii(tree1->totleaf, tree2->totleaf));
data[j]->tree1 = tree1;
data[j]->tree2 = tree2;
data[j]->max_overlap = MAX2(tree1->totleaf, tree2->totleaf);
Modified: trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp 2012-10-23 16:21:55 UTC (rev 51547)
@@ -475,10 +475,10 @@
int maxxchunk = ceil((area->xmax - 1) / chunkSizef);
int minychunk = floor(area->ymin / chunkSizef);
int maxychunk = ceil((area->ymax - 1) / chunkSizef);
- minxchunk = MAX2(minxchunk, 0);
- minychunk = MAX2(minychunk, 0);
- maxxchunk = MIN2(maxxchunk, this->m_numberOfXChunks);
- maxychunk = MIN2(maxychunk, this->m_numberOfYChunks);
+ minxchunk = max(minxchunk, 0);
+ minychunk = max(minychunk, 0);
+ maxxchunk = min(maxxchunk, this->m_numberOfXChunks);
+ maxychunk = min(maxychunk, this->m_numberOfYChunks);
bool result = true;
for (indexx = minxchunk; indexx < maxxchunk; indexx++) {
Modified: trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp 2012-10-23 16:21:55 UTC (rev 51547)
@@ -137,10 +137,10 @@
first = false;
}
else {
- output->xmin = MIN2(output->xmin, tempOutput.xmin);
- output->ymin = MIN2(output->ymin, tempOutput.ymin);
- output->xmax = MAX2(output->xmax, tempOutput.xmax);
- output->ymax = MAX2(output->ymax, tempOutput.ymax);
+ output->xmin = min(output->xmin, tempOutput.xmin);
+ output->ymin = min(output->ymin, tempOutput.ymin);
+ output->xmax = max(output->xmax, tempOutput.xmax);
+ output->ymax = max(output->ymax, tempOutput.ymax);
}
}
}
Modified: trunk/blender/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp 2012-10-23 16:21:55 UTC (rev 51547)
@@ -65,7 +65,7 @@
this->m_aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight());
this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop;
const float minsz = min(getWidth(), getHeight());
- this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
+ this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * min(img->x, img->y) / tan(0.5f * fov);
if (this->m_blurPostOperation) {
m_blurPostOperation->setSigma(min(m_aperture * 128.0f, this->m_maxRadius));
Modified: trunk/blender/source/blender/compositor/operations/COM_CropOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_CropOperation.cpp 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/compositor/operations/COM_CropOperation.cpp 2012-10-23 16:21:55 UTC (rev 51547)
@@ -54,10 +54,10 @@
if (height <= this->m_settings->y2 + 1)
this->m_settings->y2 = height - 1;
- this->m_xmax = MAX2(this->m_settings->x1, this->m_settings->x2) + 1;
- this->m_xmin = MIN2(this->m_settings->x1, this->m_settings->x2);
- this->m_ymax = MAX2(this->m_settings->y1, this->m_settings->y2) + 1;
- this->m_ymin = MIN2(this->m_settings->y1, this->m_settings->y2);
+ this->m_xmax = max(this->m_settings->x1, this->m_settings->x2) + 1;
+ this->m_xmin = min(this->m_settings->x1, this->m_settings->x2);
+ this->m_ymax = max(this->m_settings->y1, this->m_settings->y2) + 1;
+ this->m_ymin = min(this->m_settings->y1, this->m_settings->y2);
}
}
Modified: trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp 2012-10-23 15:46:44 UTC (rev 51546)
+++ trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp 2012-10-23 16:21:55 UTC (rev 51547)
@@ -344,28 +344,28 @@
for (y = 0; y < bheight; y++) {
for (x = 0; x < bwidth - 1; x++) {
p = rectf + (bwidth * y + x);
- *p = MAX2(*p, *(p + 1));
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list