Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_draw.c
| Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
| #include "WM_toolsystem.h" | #include "WM_toolsystem.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "wm.h" | #include "wm.h" | ||||
| #include "wm_draw.h" | #include "wm_draw.h" | ||||
| #include "wm_event_system.h" | #include "wm_event_system.h" | ||||
| #include "wm_surface.h" | #include "wm_surface.h" | ||||
| #include "wm_window.h" | #include "wm_window.h" | ||||
| #include "UI_resources.h" | |||||
| #ifdef WITH_OPENSUBDIV | #ifdef WITH_OPENSUBDIV | ||||
| # include "BKE_subsurf.h" | # include "BKE_subsurf.h" | ||||
| #endif | #endif | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Draw Paint Cursor | /** \name Draw Paint Cursor | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | for (pc = wm->paintcursors.first; pc; pc = pc->next) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Post Draw Region on display handlers | |||||
| * \{ */ | |||||
| static void wm_region_draw_display(bContext *C, ScrArea *area, ARegion *region) | |||||
| { | |||||
| wmWindowManager *wm = CTX_wm_manager(C); | |||||
| wmWindow *win = CTX_wm_window(C); | |||||
| /* Don't draw paint cursors with locked interface. Painting is not possible | |||||
| * then, and cursor drawing can use scene data that another thread may be | |||||
| * modifying. */ | |||||
| if (wm->is_interface_locked) { | |||||
| return; | |||||
| } | |||||
| wmViewport(®ion->winrct); | |||||
| UI_SetTheme(area->spacetype, region->regiontype); | |||||
| region->type->draw_display(C, region); | |||||
| wmWindowViewport(win); | |||||
| } | |||||
| /** \} */ | |||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Internal Utilities | /** \name Internal Utilities | ||||
| * \{ */ | * \{ */ | ||||
| static bool wm_draw_region_stereo_set(Main *bmain, | static bool wm_draw_region_stereo_set(Main *bmain, | ||||
| ScrArea *area, | ScrArea *area, | ||||
| ARegion *region, | ARegion *region, | ||||
| eStereoViews sview) | eStereoViews sview) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 605 Lines • ▼ Show 20 Lines | ED_screen_areas_iter (win, screen, area) { | ||||
| LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (region->visible && region->overlap == false) { | if (region->visible && region->overlap == false) { | ||||
| /* Blit from offscreen buffer. */ | /* Blit from offscreen buffer. */ | ||||
| wm_draw_region_blit(region, view); | wm_draw_region_blit(region, view); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Region drawing handler after updating to display. */ | |||||
| ED_screen_areas_iter (win, screen, area) { | |||||
| LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | |||||
| if (region->visible && region->type && region->type->draw_display) { | |||||
| /* make region ready for draw, scissor, pixelspace */ | |||||
| CTX_wm_area_set(C, area); | |||||
| CTX_wm_region_set(C, region); | |||||
| wm_region_draw_display(C, area, region); | |||||
| CTX_wm_region_set(C, NULL); | |||||
| CTX_wm_area_set(C, NULL); | |||||
| } | |||||
| } | |||||
| } | |||||
brecht: Maybe merge this in the paint cursors loop below.
Also for paint cursors there is… | |||||
jbakkerAuthorUnsubmitted Done Inline ActionsDone, for draw_overlay the wm_region_draw_display resets the window viewport to its original state. Another wmWindowViewport was not needed. This part could be rechecked to reduce gl setup calls that aren't necessary. jbakker: Done, for `draw_overlay` the `wm_region_draw_display` resets the window viewport to its… | |||||
| /* Draw paint cursors. */ | /* Draw paint cursors. */ | ||||
| if (wm->paintcursors.first) { | if (wm->paintcursors.first) { | ||||
| ED_screen_areas_iter (win, screen, area) { | ED_screen_areas_iter (win, screen, area) { | ||||
| LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (region->visible && region == screen->active_region) { | if (region->visible && region == screen->active_region) { | ||||
| CTX_wm_area_set(C, area); | CTX_wm_area_set(C, area); | ||||
| CTX_wm_region_set(C, region); | CTX_wm_region_set(C, region); | ||||
| ▲ Show 20 Lines • Show All 332 Lines • Show Last 20 Lines | |||||
Maybe merge this in the paint cursors loop below.
Also for paint cursors there is wmWindowViewport to reset the OpenGL viewport to the whole window. I would guess this is needed for the draw_display case as well.