Fix GPU_viewport size asserts in some cases.

Now always tag for redraw when region size is changed instead of relying on
a redraw tag having been done elsewhere.
This commit is contained in:
Brecht Van Lommel 2018-08-17 20:14:06 +02:00
parent 6cad7984c6
commit 7f9a1d2f3b
2 changed files with 11 additions and 9 deletions

@ -1128,12 +1128,13 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rcti *overlap_remainder, int quad)
{
rcti *remainder_prev = remainder;
int prefsizex, prefsizey;
int alignment;
if (ar == NULL)
return;
int prev_winx = ar->winx;
int prev_winy = ar->winy;
/* no returns in function, winrct gets set in the end again */
BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
@ -1142,7 +1143,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct
if (ar->prev)
remainder = &ar->prev->winrct;
alignment = ar->alignment & ~RGN_SPLIT_PREV;
int alignment = ar->alignment & ~RGN_SPLIT_PREV;
/* set here, assuming userpref switching forces to call this again */
ar->overlap = ED_region_is_overlap(sa->spacetype, ar->regiontype);
@ -1155,7 +1156,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct
}
/* prefsize, taking into account DPI */
prefsizex = UI_DPI_FAC * ((ar->sizex > 1) ? ar->sizex + 0.5f : ar->type->prefsizex);
int prefsizex = UI_DPI_FAC * ((ar->sizex > 1) ? ar->sizex + 0.5f : ar->type->prefsizex);
int prefsizey;
if (ar->regiontype == RGN_TYPE_HEADER) {
prefsizey = ED_area_headersize();
@ -1377,6 +1379,11 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct
}
region_rect_recursive(sa, ar->next, remainder, overlap_remainder, quad);
/* Tag for redraw if size changes. */
if (ar->winx != prev_winx || ar->winy != prev_winy) {
ED_region_tag_redraw(ar);
}
}
static void area_calc_totrct(ScrArea *sa, const rcti *window_rect)

@ -439,15 +439,10 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
/* exception for bg mode, we only need the screen context */
if (!G.background) {
rcti window_rect, screen_rect;
/* header size depends on DPI, let's verify */
WM_window_set_dpi(win);
screen_refresh_headersizes();
WM_window_rect_calc(win, &window_rect);
WM_window_screen_rect_calc(win, &screen_rect); /* Get screen bounds __after__ updating window DPI! */
screen_geom_vertices_scale(win, screen);
ED_screen_areas_iter(win, screen, area) {