Fix #21470: changing brush settings redraws the 3d view unecessarily,
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 23 Jun 2010 09:58:32 +0000 (09:58 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 23 Jun 2010 09:58:32 +0000 (09:58 +0000)
added ED_region_tag_redraw_overlay to only redo overlay drawing, which
in case of triple buffer is much faster.

source/blender/editors/include/ED_screen.h
source/blender/editors/screen/area.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesdna/DNA_screen_types.h
source/blender/windowmanager/intern/wm_draw.c

index 21a8fa7..3478447 100644 (file)
@@ -55,6 +55,7 @@ void  ED_region_set(const struct bContext *C, struct ARegion *ar);
 void   ED_region_init(struct bContext *C, struct ARegion *ar);
 void   ED_region_tag_redraw(struct ARegion *ar);
 void   ED_region_tag_redraw_partial(struct ARegion *ar, struct rcti *rct);
+void   ED_region_tag_redraw_overlay(struct ARegion *ar);
 void   ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *ar);
 void   ED_region_panels(const struct bContext *C, struct ARegion *ar, int vertical, char *context, int contextnr);
 void   ED_region_header_init(struct ARegion *ar);
index 758a2b1..65b2923 100644 (file)
@@ -372,6 +372,12 @@ void ED_region_tag_redraw(ARegion *ar)
        }
 }
 
+void ED_region_tag_redraw_overlay(ARegion *ar)
+{
+       if(ar)
+               ar->do_draw_overlay= RGN_DRAW;
+}
+
 void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
 {
        if(ar) {
index 472379e..92e3b35 100644 (file)
@@ -587,7 +587,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
                        break;
                case NC_BRUSH:
                        if(wmn->action == NA_EDITED)
-                               ED_region_tag_redraw(ar);
+                               ED_region_tag_redraw_overlay(ar);
                        break;                  
                case NC_MATERIAL:
                        switch(wmn->data) {
index 6d73c26..a811fd9 100644 (file)
@@ -152,7 +152,9 @@ typedef struct ARegion {
        short sizex, sizey;                     /* current split size in pixels (if zero it uses regiontype) */
        
        short do_draw;                          /* private, cached notifier events */
+       short do_draw_overlay;          /* private, cached notifier events */
        short swap;                                     /* private, indicator to survive swap-exchange */
+       short pad[3];
        
        struct ARegionType *type;       /* callbacks for this region type */
        
index 0331613..d2afef3 100644 (file)
@@ -642,6 +642,13 @@ static int wm_draw_update_test_window(wmWindow *win)
 {
        ScrArea *sa;
        ARegion *ar;
+
+       for(ar= win->screen->regionbase.first; ar; ar= ar->next) {
+               if(ar->do_draw_overlay) {
+                       wm_tag_redraw_overlay(win, ar);
+                       ar->do_draw_overlay= 0;
+               }
+       }
        
        if(win->screen->do_refresh)
                return 1;
@@ -687,8 +694,11 @@ static int wm_automatic_draw_method(wmWindow *win)
 void wm_tag_redraw_overlay(wmWindow *win, ARegion *ar)
 {
        /* for draw triple gestures, paint cursors don't need region redraw */
-       if(ar && win && wm_automatic_draw_method(win) != USER_DRAW_TRIPLE)
-               ED_region_tag_redraw(ar);
+       if(ar && win) {
+               if(wm_automatic_draw_method(win) != USER_DRAW_TRIPLE)
+                       ED_region_tag_redraw(ar);
+               win->screen->do_draw_paintcursor= 1;
+       }
 }
 
 void wm_draw_update(bContext *C)