[Bf-blender-cvs] [825a93d7cdd] master: Fix T70317: Equal clip range crashing in Hue Correct & RGB Curves Nodes
mano-wii
noreply at git.blender.org
Tue Oct 1 17:28:22 CEST 2019
Commit: 825a93d7cddd0fb28431f12b0927b45b8eca4125
Author: mano-wii
Date: Tue Oct 1 12:26:38 2019 -0300
Branches: master
https://developer.blender.org/rB825a93d7cddd0fb28431f12b0927b45b8eca4125
Fix T70317: Equal clip range crashing in Hue Correct & RGB Curves Nodes
It takes many changes to support the drawing of zero-sized curves.
Best skip these cases to avoid crash.
Blender 2.79 had no support either.
===================================================================
M source/blender/editors/interface/interface_draw.c
===================================================================
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 551e25a5986..72c31c7b39e 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1849,9 +1849,17 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
cumap = (CurveMapping *)but->poin;
}
+ float clip_size_x = BLI_rctf_size_x(&cumap->curr);
+ float clip_size_y = BLI_rctf_size_y(&cumap->curr);
+
+ /* zero-sized curve */
+ if (clip_size_x == 0.0f || clip_size_y == 0.0f) {
+ return;
+ }
+
/* calculate offset and zoom */
- float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&cumap->curr);
- float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / BLI_rctf_size_y(&cumap->curr);
+ float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / clip_size_x;
+ float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / clip_size_y;
float offsx = cumap->curr.xmin - (1.0f / zoomx);
float offsy = cumap->curr.ymin - (1.0f / zoomy);
More information about the Bf-blender-cvs
mailing list