diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-16 18:59:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-16 18:59:36 +0300 |
commit | bc9b873f60d414a5247063e0ad6ad0a9325d3d2f (patch) | |
tree | 403b5aa72e9397ba5ceb97f8be7cc77914609b99 /source/blender | |
parent | 2061f91741861f5646974b4960b5ff03d509f5eb (diff) |
bugfix [#20480] crash/lock-up for certain aspect ratios
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_rect.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index c9ba0307118..52f645705cc 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -47,6 +47,7 @@ extern "C" { * @return True if @a rect is empty. */ int BLI_rcti_is_empty(struct rcti *rect); +int BLI_rctf_is_empty(struct rctf *rect); void BLI_init_rctf(struct rctf *rect, float xmin, float xmax, float ymin, float ymax); void BLI_init_rcti(struct rcti *rect, int xmin, int xmax, int ymin, int ymax); void BLI_translate_rctf(struct rctf *rect, float x, float y); diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 221aaa725d6..959d8be466f 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -48,6 +48,12 @@ int BLI_rcti_is_empty(rcti * rect) (rect->ymax<=rect->ymin)); } +int BLI_rctf_is_empty(rctf * rect) +{ + return ((rect->xmax<=rect->xmin) || + (rect->ymax<=rect->ymin)); +} + int BLI_in_rcti(rcti * rect, int x, int y) { diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 51598fb6d94..5928e5cf20e 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -205,7 +205,7 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node) node->prvr.xmin= node->locx + NODE_DYS; node->prvr.xmax= node->locx + node->width- NODE_DYS; - + /* preview rect? */ if(node->flag & NODE_PREVIEW) { /* only recalculate size when there's a preview actually, otherwise we use stored result */ @@ -820,7 +820,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN /* preview */ if(node->flag & NODE_PREVIEW) { BLI_lock_thread(LOCK_PREVIEW); - if(node->preview && node->preview->rect) + if(node->preview && node->preview->rect && !BLI_rctf_is_empty(&node->prvr)) node_draw_preview(node->preview, &node->prvr); BLI_unlock_thread(LOCK_PREVIEW); } |