[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59912] trunk/blender/source/blender: missing NULL check in recent commit, also skip some calculations in mean_value_half_tan functions for degenerate cases .
Campbell Barton
ideasman42 at gmail.com
Sat Sep 7 08:56:27 CEST 2013
Revision: 59912
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59912
Author: campbellbarton
Date: 2013-09-07 06:56:27 +0000 (Sat, 07 Sep 2013)
Log Message:
-----------
missing NULL check in recent commit, also skip some calculations in mean_value_half_tan functions for degenerate cases.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/math_geom.c
trunk/blender/source/blender/editors/space_node/node_draw.c
Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c 2013-09-07 06:13:27 UTC (rev 59911)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c 2013-09-07 06:56:27 UTC (rev 59912)
@@ -2394,17 +2394,16 @@
* more than 3 vertices */
static float mean_value_half_tan_v3(const float v1[3], const float v2[3], const float v3[3])
{
- float d2[3], d3[3], cross[3], area, dot, len;
+ float d2[3], d3[3], cross[3], area;
sub_v3_v3v3(d2, v2, v1);
sub_v3_v3v3(d3, v3, v1);
cross_v3_v3v3(cross, d2, d3);
area = len_v3(cross);
- dot = dot_v3v3(d2, d3);
- len = len_v3(d2) * len_v3(d3);
-
if (LIKELY(area != 0.0f)) {
+ const float dot = dot_v3v3(d2, d3);
+ const float len = len_v3(d2) * len_v3(d3);
return (len - dot) / area;
}
else {
@@ -2413,18 +2412,16 @@
}
static float mean_value_half_tan_v2(const float v1[2], const float v2[2], const float v3[2])
{
- float d2[2], d3[2], area, dot, len;
+ float d2[2], d3[2], area;
sub_v2_v2v2(d2, v2, v1);
sub_v2_v2v2(d3, v3, v1);
/* different from the 3d version but still correct */
area = cross_v2v2(d2, d3);
-
- dot = dot_v2v2(d2, d3);
- len = len_v2(d2) * len_v2(d3);
-
if (LIKELY(area != 0.0f)) {
+ const float dot = dot_v2v2(d2, d3);
+ const float len = len_v2(d2) * len_v2(d3);
return (len - dot) / area;
}
else {
Modified: trunk/blender/source/blender/editors/space_node/node_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_draw.c 2013-09-07 06:13:27 UTC (rev 59911)
+++ trunk/blender/source/blender/editors/space_node/node_draw.c 2013-09-07 06:56:27 UTC (rev 59912)
@@ -925,7 +925,7 @@
/* preview */
if (node->flag & NODE_PREVIEW && previews) {
bNodePreview *preview = BKE_node_instance_hash_lookup(previews, key);
- if (preview->xsize && preview->ysize) {
+ if (preview && (preview->xsize && preview->ysize)) {
if (preview->rect && !BLI_rctf_is_empty(&node->prvr)) {
node_draw_preview(preview, &node->prvr);
}
More information about the Bf-blender-cvs
mailing list