forked from bartvdbraak/blender
2.5
Testing commit; this puts back support for swap-exchange graphics cards, which I had hoped to have faded out... but it appears it still does it for intel and some atis. This only swap-exchanges properly for areas/regions, not for menus or the 'action zone triange'. Let's see if it works! You enable it with starting with commandline option -E
This commit is contained in:
parent
fd4c399a87
commit
87d5d0aa10
@ -124,7 +124,7 @@ typedef struct Global {
|
||||
|
||||
/* G.f */
|
||||
#define G_RENDER_OGL (1 << 0)
|
||||
#define G_PLAYANIM (1 << 1)
|
||||
#define G_SWAP_EXCHANGE (1 << 1)
|
||||
/* also uses G_FILE_AUTOPLAY */
|
||||
#define G_RENDER_SHADOW (1 << 3)
|
||||
#define G_BACKBUFSEL (1 << 4)
|
||||
|
@ -360,6 +360,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
|
||||
/* special cases, override loaded flags: */
|
||||
if (G.f & G_DEBUG) bfd->globalf |= G_DEBUG;
|
||||
else bfd->globalf &= ~G_DEBUG;
|
||||
if (G.f & G_SWAP_EXCHANGE) bfd->globalf |= G_SWAP_EXCHANGE;
|
||||
else bfd->globalf &= ~G_SWAP_EXCHANGE;
|
||||
|
||||
if ((U.flag & USER_DONT_DOSCRIPTLINKS)) bfd->globalf &= ~G_DOSCRIPTLINKS;
|
||||
|
||||
|
@ -233,6 +233,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
|
||||
ED_region_pixelspace(ar);
|
||||
|
||||
ar->do_draw= 0;
|
||||
ar->swap= WIN_BACK_OK;
|
||||
}
|
||||
|
||||
/* **********************************
|
||||
|
@ -990,6 +990,7 @@ void ED_screen_draw(wmWindow *win)
|
||||
|
||||
if(G.f & G_DEBUG) printf("draw screen\n");
|
||||
win->screen->do_draw= 0;
|
||||
win->screen->swap= WIN_BACK_OK;
|
||||
}
|
||||
|
||||
/* make this screen usable */
|
||||
|
@ -2048,7 +2048,6 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
|
||||
// if (v3d->flag2 & V3D_DISPGP)
|
||||
// draw_gpencil_3dview(ar, 0);
|
||||
|
||||
if(!(G.f & G_PLAYANIM)) drawcursor(scene, ar, v3d);
|
||||
if(U.uiflag & USER_SHOW_ROTVIEWICON)
|
||||
draw_view_axis(v3d);
|
||||
else
|
||||
|
@ -55,7 +55,8 @@ typedef struct bScreen {
|
||||
short do_draw; /* notifier for drawing edges */
|
||||
short do_refresh; /* notifier for scale screen, changed screen, etc */
|
||||
short do_gesture; /* notifier for gesture draw. */
|
||||
short pad[3];
|
||||
short swap; /* indicator to survive swap-exchange systems */
|
||||
short pad[2];
|
||||
|
||||
short mainwin; /* screensize subwindow, for screenedges and global menus */
|
||||
short subwinactive; /* active subwindow */
|
||||
@ -136,7 +137,7 @@ typedef struct ARegion {
|
||||
float fsize; /* current split size in float */
|
||||
|
||||
short do_draw; /* private, cached notifier events */
|
||||
short pad;
|
||||
short swap; /* private, indicator to survive swap-exchange */
|
||||
int pad1;
|
||||
|
||||
struct ARegionType *type; /* callbacks for this region type */
|
||||
@ -149,6 +150,11 @@ typedef struct ARegion {
|
||||
void *regiondata; /* XXX 2.50, need spacedata equivalent? */
|
||||
} ARegion;
|
||||
|
||||
/* swap */
|
||||
#define WIN_BACK_OK 1
|
||||
#define WIN_FRONT_OK 2
|
||||
#define WIN_EQUAL 3
|
||||
|
||||
/* area->flag */
|
||||
#define HEADER_NO_PULLDOWN 1
|
||||
#define AREA_FLAG_DRAWJOINTO 2
|
||||
@ -168,11 +174,6 @@ typedef struct ARegion {
|
||||
#define SCREENFULL 1
|
||||
#define SCREENAUTOPLAY 2
|
||||
|
||||
/* sa->win_swap */
|
||||
#define WIN_FRONT_OK 1
|
||||
#define WIN_BACK_OK 2
|
||||
#define WIN_EQUAL 3
|
||||
|
||||
/* Panel->snap - for snapping to screen edges */
|
||||
#define PNL_SNAP_NONE 0
|
||||
#define PNL_SNAP_TOP 1
|
||||
|
@ -199,6 +199,68 @@ void wm_event_do_notifiers(bContext *C)
|
||||
CTX_wm_window_set(C, NULL);
|
||||
}
|
||||
|
||||
/* ********************* drawing, swap ****************** */
|
||||
|
||||
static void wm_paintcursor_draw(bContext *C)
|
||||
{
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
|
||||
if(wm->paintcursors.first) {
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
wmPaintCursor *pc;
|
||||
|
||||
for(pc= wm->paintcursors.first; pc; pc= pc->next) {
|
||||
if(pc->poll(C)) {
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
pc->draw(C, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void wm_window_swap_exchange(bContext *C, wmWindow *win)
|
||||
{
|
||||
ARegion *ar;
|
||||
ScrArea *sa;
|
||||
|
||||
if(win->screen->swap==WIN_FRONT_OK) {
|
||||
ED_screen_draw(win);
|
||||
win->screen->swap= WIN_EQUAL;
|
||||
}
|
||||
else if(win->screen->swap==WIN_BACK_OK) {
|
||||
win->screen->swap= WIN_FRONT_OK;
|
||||
}
|
||||
|
||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||
|
||||
CTX_wm_area_set(C, sa);
|
||||
|
||||
for(ar=sa->regionbase.first; ar; ar= ar->next) {
|
||||
if(ar->swinid) {
|
||||
if(ar->swap == WIN_BACK_OK) {
|
||||
ar->swap = WIN_FRONT_OK;
|
||||
}
|
||||
else if(ar->swap == WIN_FRONT_OK) {
|
||||
CTX_wm_region_set(C, ar);
|
||||
|
||||
ED_region_do_draw(C, ar);
|
||||
if(win->screen->subwinactive==ar->swinid)
|
||||
wm_paintcursor_draw(C);
|
||||
|
||||
ar->swap = WIN_EQUAL;
|
||||
|
||||
CTX_wm_region_set(C, NULL);
|
||||
printf("draws swap exchange %d\n", ar->swinid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CTX_wm_area_set(C, NULL);
|
||||
}
|
||||
|
||||
wm_window_swap_buffers(win);
|
||||
}
|
||||
|
||||
/* mark area-regions to redraw if overlapped with rect */
|
||||
static void wm_flush_regions_down(bScreen *screen, rcti *dirty)
|
||||
{
|
||||
@ -277,23 +339,6 @@ static int wm_draw_update_test_window(wmWindow *win)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void wm_paintcursor_draw(bContext *C)
|
||||
{
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
|
||||
if(wm->paintcursors.first) {
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
wmPaintCursor *pc;
|
||||
|
||||
for(pc= wm->paintcursors.first; pc; pc= pc->next) {
|
||||
if(pc->poll(C)) {
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
pc->draw(C, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wm_draw_update(bContext *C)
|
||||
{
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
@ -355,7 +400,10 @@ void wm_draw_update(bContext *C)
|
||||
if(win->screen->do_gesture)
|
||||
wm_gesture_draw(win);
|
||||
|
||||
wm_window_swap_buffers(win);
|
||||
if(G.f & G_SWAP_EXCHANGE)
|
||||
wm_window_swap_exchange(C, win);
|
||||
else
|
||||
wm_window_swap_buffers(win);
|
||||
|
||||
CTX_wm_window_set(C, NULL);
|
||||
}
|
||||
|
@ -439,7 +439,9 @@ int main(int argc, char **argv)
|
||||
printf("argv[%d] = %s\n", i, argv[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
G.f |= G_SWAP_EXCHANGE;
|
||||
break;
|
||||
case 'w':
|
||||
/* with borders XXX OLD CRUFT!*/
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user