From a59841b016f76dea59fb86aa18980447199a1451 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 1 Feb 2010 10:02:53 +0000 Subject: WM Draw Method added to do Overlap assuming swap exchange / flipping, and made that the default for windows software opengl because that seems to be working better at least on XP. Previously this could only be specified from the command line. --- source/blender/makesdna/DNA_userdef_types.h | 1 + source/blender/makesrna/intern/rna_userdef.c | 1 + source/blender/windowmanager/intern/wm_draw.c | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 66812efdf3f..24d54bae1fa 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -486,6 +486,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_DRAW_OVERLAP 1 #define USER_DRAW_FULL 2 #define USER_DRAW_AUTOMATIC 3 +#define USER_DRAW_OVERLAP_FLIP 4 /* tw_flag (transform widget) */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index fc677d9d6f7..a83ff71378f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2170,6 +2170,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {USER_DRAW_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically set based on graphics card and driver."}, {USER_DRAW_TRIPLE, "TRIPLE_BUFFER", 0, "Triple Buffer", "Use a third buffer for minimal redraws at the cost of more memory."}, {USER_DRAW_OVERLAP, "OVERLAP", 0, "Overlap", "Redraw all overlapping regions, minimal memory usage but more redraws."}, + {USER_DRAW_OVERLAP_FLIP, "OVERLAP_FLIP", 0, "Overlap Flip", "Redraw all overlapping regions, minimal memory usage but more redraws (for graphics drivers that do flipping)."}, {USER_DRAW_FULL, "FULL", 0, "Full", "Do a full redraw each time, slow, only use for reference or when all else fails."}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 0bbd3757f27..9372e49597d 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -180,14 +180,13 @@ static void wm_flush_regions_up(bScreen *screen, rcti *dirty) } } -static void wm_method_draw_overlap_all(bContext *C, wmWindow *win) +static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange) { wmWindowManager *wm= CTX_wm_manager(C); bScreen *screen= win->screen; ScrArea *sa; ARegion *ar; static rcti rect= {0, 0, 0, 0}; - int exchange= (G.f & G_SWAP_EXCHANGE); /* flush overlapping regions */ if(screen->regionbase.first) { @@ -400,7 +399,7 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win) wm_draw_window_clear(win); win->drawfail= 1; - wm_method_draw_overlap_all(C, win); + wm_method_draw_overlap_all(C, win, 0); } static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple) @@ -688,22 +687,23 @@ void wm_draw_update(bContext *C) ED_screen_refresh(wm, win); if(win->drawfail) - wm_method_draw_overlap_all(C, win); + wm_method_draw_overlap_all(C, win, 0); else if(win->drawmethod == USER_DRAW_AUTOMATIC) { /* ATI opensource driver is known to be very slow at this, Windows software driver darkens color on each redraw */ - if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE) || - GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE)) - wm_method_draw_overlap_all(C, win); + if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) + wm_method_draw_overlap_all(C, win, 0); + else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE)) + wm_method_draw_overlap_all(C, win, 1); else wm_method_draw_triple(C, win); } else if(win->drawmethod == USER_DRAW_FULL) wm_method_draw_full(C, win); else if(win->drawmethod == USER_DRAW_OVERLAP) - wm_method_draw_overlap_all(C, win); - /*else if(win->drawmethod == USER_DRAW_DAMAGE) - wm_method_draw_damage(C, win);*/ + wm_method_draw_overlap_all(C, win, 0); + else if(win->drawmethod == USER_DRAW_OVERLAP_FLIP) + wm_method_draw_overlap_all(C, win, 1); else // if(win->drawmethod == USER_DRAW_TRIPLE) wm_method_draw_triple(C, win); -- cgit v1.2.3