Commit: 064cbe9f3fe07e65b3f74ef7fd034e0e62934ace
Author: Julian Eisel
Date:   Sun Dec 23 18:04:48 2018 +0100
Branches: master
https://developer.blender.org/rB064cbe9f3fe07e65b3f74ef7fd034e0e62934ace

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.

===================================================================

M       source/blender/editors/screen/area.c

===================================================================

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);
        }
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to