diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2018-12-23 20:04:48 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2018-12-23 20:04:48 +0300 |
commit | 064cbe9f3fe07e65b3f74ef7fd034e0e62934ace (patch) | |
tree | fac3730c435f6302e58490c41b161488dab786c8 /source/blender/editors/screen | |
parent | 6b13f10d40e5960dbe93153388f3eca3ab82620a (diff) |
Avoid creating & registering zero sized AZones
Would allocate memory for AZones and register them even if their
coordinates/bounding-box was all 0, meaning they're not visible and not
interactive.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index a01eaa2b5a4..43ff12540db 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -957,12 +957,26 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar) BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2); } +static bool region_azone_edge_poll(const ARegion *ar, const bool is_fullscreen) +{ + const bool is_hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)); + + if (is_hidden && is_fullscreen) { + return false; + } + if (!is_hidden && ar->regiontype == RGN_TYPE_HEADER) { + return false; + } + + return true; +} + static void region_azone_edge_initialize(ScrArea *sa, ARegion *ar, AZEdge edge, const bool is_fullscreen) { AZone *az = NULL; const bool is_hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)); - if (is_hidden && is_fullscreen) { + if (!region_azone_edge_poll(ar, is_fullscreen)) { return; } @@ -975,7 +989,7 @@ static void region_azone_edge_initialize(ScrArea *sa, ARegion *ar, AZEdge edge, if (is_hidden) { region_azone_tab_plus(sa, az, ar); } - else if (!is_hidden && (ar->regiontype != RGN_TYPE_HEADER)) { + else { region_azone_edge(az, ar); } } |