diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-10-01 18:26:38 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-10-01 18:26:47 +0300 |
commit | 825a93d7cddd0fb28431f12b0927b45b8eca4125 (patch) | |
tree | 0940cba0b48a1117ec8aa3eb1f76922dbef46e2e /source/blender/editors | |
parent | b155ece0c0e5feb5f51690989687d4b825cd848c (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 12 |
1 files changed, 10 insertions, 2 deletions
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); |