Blender V5.3
wm_draw.cc File Reference
#include <cstdlib>
#include <cstring>
#include "DNA_camera_types.h"
#include "DNA_color_types.h"
#include "DNA_listBase.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_rect.hh"
#include "BLI_utildefines.hh"
#include "BKE_context.hh"
#include "BKE_image.hh"
#include "BKE_layer.hh"
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "GHOST_ISystem.hh"
#include "GHOST_IWindow.hh"
#include "GHOST_Rect.hh"
#include "GHOST_Types.hh"
#include "ED_node.hh"
#include "ED_screen.hh"
#include "ED_view3d.hh"
#include "GPU_batch_presets.hh"
#include "GPU_capabilities.hh"
#include "GPU_context.hh"
#include "GPU_debug.hh"
#include "GPU_framebuffer.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "GPU_texture.hh"
#include "GPU_viewport.hh"
#include "PRF_profile.hh"
#include "RE_engine.h"
#include "WM_api.hh"
#include "WM_toolsystem.hh"
#include "WM_types.hh"
#include "wm.hh"
#include "wm_draw.hh"
#include "wm_event_system.hh"
#include "wm_surface.hh"
#include "wm_window.hh"
#include "wm_window_private.hh"
#include "UI_resources.hh"
#include "IMB_colormanagement.hh"

Go to the source code of this file.

Classes

struct  blender::GrabState
struct  blender::WindowDrawCB

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define SPACE_NAME(space)

Functions

Internal Utilities
static bool blender::wm_window_grab_warp_region_is_set (const wmWindow *win)
static bool blender::wm_draw_region_stereo_set (Main *bmain, ScrArea *area, ARegion *region, eStereoViews sview)
static void blender::wm_region_test_gizmo_do_draw (bContext *C, ScrArea *area, ARegion *region, bool tag_redraw)
static void blender::wm_region_test_render_do_draw (const Scene *scene, Depsgraph *depsgraph, ScrArea *area, ARegion *region)
static bool blender::wm_region_use_viewport_by_type (short space_type, short region_type)
bool blender::WM_region_use_viewport (ScrArea *area, ARegion *region)
static const char * blender::wm_area_name (const ScrArea *area)
Draw Paint Cursor
static void blender::wm_paintcursor_draw (bContext *C, ScrArea *area, ARegion *region)
Post Draw Region on display handlers
static void blender::wm_region_draw_overlay (bContext *C, const ScrArea *area, ARegion *region)
Window Drawing (Draw All)

Reference method, draw all each time.

void * blender::WM_draw_cb_activate (wmWindow *win, void(*draw)(const wmWindow *win, void *customdata), void *customdata)
void blender::WM_draw_cb_exit (wmWindow *win, void *handle)
static void blender::wm_draw_callbacks (wmWindow *win)
Region Drawing

Each region draws into its own frame-buffer, which is then blit on the window draw buffer. This helps with fast redrawing if only some regions change. It also means we can share a single context for multiple windows, so that for example VAOs can be shared between windows.

static void blender::wm_draw_region_buffer_free (ARegion *region)
static void blender::wm_draw_offscreen_texture_parameters (GPUOffScreen *offscreen)
static gpu::TextureFormat blender::get_hdr_framebuffer_format (const Scene *scene)
static void blender::wm_draw_region_buffer_create (Scene *scene, ARegion *region, bool stereo, bool use_viewport)
static void blender::wm_draw_region_bind (ARegion *region, int view)
static void blender::wm_draw_region_unbind (ARegion *region)
static void blender::wm_draw_region_blit (ARegion *region, int view)
gpu::Texture * blender::wm_draw_region_texture (ARegion *region, int view)
void blender::wm_draw_region_blend (ARegion *region, int view, bool blend)
GPUViewport * blender::WM_draw_region_get_viewport (ARegion *region)
GPUViewport * blender::WM_draw_region_get_bound_viewport (ARegion *region)
static void blender::wm_draw_area_offscreen (bContext *C, wmWindow *win, ScrArea *area, bool stereo)
static void blender::wm_draw_window_offscreen (bContext *C, wmWindow *win, bool stereo)
static void blender::wm_draw_window_onscreen (bContext *C, wmWindow *win, int view)
static void blender::wm_draw_window (bContext *C, wmWindow *win)
static void blender::wm_draw_surface (bContext *C, wmSurface *surface)
Window Screen Shot Utility (Front-Buffer & Off-Screen)

Include here since it can involve low level buffer switching.

uint8_t * blender::WM_window_pixels_read_from_frontbuffer (const wmWindowManager *wm, const wmWindow *win, int r_size[2])
void blender::WM_window_pixels_read_sample_from_frontbuffer (const wmWindowManager *wm, const wmWindow *win, const int pos[2], float r_col[3])
uint8_t * blender::WM_window_pixels_read_from_offscreen (bContext *C, wmWindow *win, int r_size[2])
bool blender::WM_window_pixels_read_sample_from_offscreen (bContext *C, wmWindow *win, const int pos[2], float r_col[3])
static bool blender::wm_window_pixels_read_use_frontbuffer ()
uint8_t * blender::WM_window_pixels_read (bContext *C, wmWindow *win, int r_size[2])
bool blender::WM_window_pixels_read_sample (bContext *C, wmWindow *win, const int pos[2], float r_col[3])
bool blender::WM_desktop_cursor_sample_read (float r_col[3])
Main Update Call
static bool blender::wm_draw_update_test_window (Main *bmain, bContext *C, wmWindow *win)
static void blender::wm_draw_update_clear_window (bContext *C, wmWindow *win)
void blender::WM_paint_cursor_tag_redraw (wmWindow *win, ARegion *)
void blender::wm_draw_update (bContext *C)
void blender::wm_draw_region_clear (wmWindow *win, ARegion *)
void blender::WM_draw_region_free (ARegion *region)
void blender::wm_draw_region_test (bContext *C, ScrArea *area, ARegion *region)
void blender::WM_redraw_windows (bContext *C)
Region Viewport Drawing

This is needed for viewport drawing for operator use (where the viewport may not have drawn yet).

Otherwise avoid using these since they're exposing low level logic externally.

void blender::WM_draw_region_viewport_ensure (Scene *scene, ARegion *region, short space_type)
void blender::WM_draw_region_viewport_bind (ARegion *region)
void blender::WM_draw_region_viewport_unbind (ARegion *region)

Draw Software Cursor

Draw the cursor instead of relying on the graphical environment. Needed when setting the cursor position (warping) isn't supported (GHOST/WAYLAND).

static struct  blender::g_software_cursor
static bool blender::wm_software_cursor_needed ()
static bool blender::wm_software_cursor_needed_for_window (const wmWindow *win, GrabState *grab_state)
static bool blender::wm_software_cursor_motion_test (const wmWindow *win)
static void blender::wm_software_cursor_motion_update (const wmWindow *win)
static void blender::wm_software_cursor_motion_clear ()
static void blender::wm_software_cursor_motion_clear_with_window (const wmWindow *win)
static void blender::wm_software_cursor_draw_bitmap (const float system_scale, const int event_xy[2], const GHOST_CursorBitmapRef *bitmap)
static void blender::wm_software_cursor_draw_crosshair (const float system_scale, const int event_xy[2])
static void blender::wm_software_cursor_draw (wmWindow *win, const GrabState *grab_state)

Detailed Description

Handle OpenGL buffers for windowing, also paint cursor.

Definition in file wm_draw.cc.

Macro Definition Documentation

◆ SPACE_NAME

#define SPACE_NAME ( space)
Value:
case space: { \
return #space; \
}

Referenced by blender::wm_area_name().