Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_draw.c')
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c61
1 files changed, 45 insertions, 16 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index fa12d6cf974..3c2bc14837d 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -69,6 +69,8 @@
#include "wm_surface.h"
#include "wm_window.h"
+#include "UI_resources.h"
+
#ifdef WITH_OPENSUBDIV
# include "BKE_subsurf.h"
#endif
@@ -128,6 +130,28 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Post Draw Region on display handlers
+ * \{ */
+
+static void wm_region_draw_overlay(bContext *C, ScrArea *area, ARegion *region)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
+
+ /* Don't draw overlay with locked interface. Drawing could access scene data that another thread
+ * may be modifying. */
+ if (wm->is_interface_locked) {
+ return;
+ }
+
+ wmViewport(&region->winrct);
+ UI_SetTheme(area->spacetype, region->regiontype);
+ region->type->draw_overlay(C, region);
+ wmWindowViewport(win);
+}
+
+/** \} */
+/* -------------------------------------------------------------------- */
/** \name Internal Utilities
* \{ */
@@ -749,25 +773,30 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
}
}
- /* Draw paint cursors. */
- if (wm->paintcursors.first) {
- ED_screen_areas_iter (win, screen, area) {
- LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
- if (region->visible && region == screen->active_region) {
- CTX_wm_area_set(C, area);
- CTX_wm_region_set(C, region);
+ /* Draw overlays and paint cursors. */
+ ED_screen_areas_iter (win, screen, area) {
+ LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
+ if (region->visible) {
+ const bool do_paint_cursor = (wm->paintcursors.first && region == screen->active_region);
+ const bool do_draw_overlay = (region->type && region->type->draw_overlay);
+ if (!(do_paint_cursor || do_draw_overlay)) {
+ continue;
+ }
- /* make region ready for draw, scissor, pixelspace */
+ CTX_wm_area_set(C, area);
+ CTX_wm_region_set(C, region);
+ if (do_draw_overlay) {
+ wm_region_draw_overlay(C, area, region);
+ }
+ if (do_paint_cursor) {
wm_paintcursor_draw(C, area, region);
-
- CTX_wm_region_set(C, NULL);
- CTX_wm_area_set(C, NULL);
}
+ CTX_wm_region_set(C, NULL);
+ CTX_wm_area_set(C, NULL);
}
}
-
- wmWindowViewport(win);
}
+ wmWindowViewport(win);
/* Blend in overlapping area regions */
ED_screen_areas_iter (win, screen, area) {
@@ -902,9 +931,9 @@ static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win)
bool do_draw = false;
for (region = screen->regionbase.first; region; region = region->next) {
- if (region->do_draw_overlay) {
+ if (region->do_draw_paintcursor) {
screen->do_draw_paintcursor = true;
- region->do_draw_overlay = false;
+ region->do_draw_paintcursor = false;
}
if (region->visible && region->do_draw) {
do_draw = true;
@@ -983,7 +1012,7 @@ void wm_draw_update(bContext *C)
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win;
- GPU_free_unused_buffers(bmain);
+ GPU_free_unused_buffers();
for (win = wm->windows.first; win; win = win->next) {
#ifdef WIN32