62 #ifdef WITH_OPENSUBDIV
96 if (pc->poll ==
NULL || pc->poll(
C)) {
109 pc->draw(
C,
x,
y, pc->customdata);
162 bool use_software_cursor;
167 &use_software_cursor);
168 if (use_software_cursor) {
202 float gl_matrix[4][4];
210 const int scale = (int)
U.pixelsize;
214 gl_matrix[3][0] = event_xy[0] - (bitmap->
hot_spot[0] * scale);
215 gl_matrix[3][1] = event_xy[1] - ((bitmap->
data_size[1] - bitmap->
hot_spot[1]) * scale);
217 gl_matrix[0][0] = bitmap->
data_size[0] * scale;
218 gl_matrix[1][1] = bitmap->
data_size[1] * scale;
263 const float unit =
max_ff(
U.dpi_fac, 1.0f);
270 const int ofs_line = (8 * unit);
271 const int ofs_size = (2 * unit);
273 event_xy[0] - ofs_line,
274 event_xy[1] - ofs_size,
275 event_xy[0] + ofs_line,
276 event_xy[1] + ofs_size);
278 event_xy[0] - ofs_size,
279 event_xy[1] - ofs_line,
280 event_xy[0] + ofs_size,
281 event_xy[1] + ofs_line);
285 const int ofs_line = (7 * unit);
286 const int ofs_size = (1 * unit);
288 event_xy[0] - ofs_line,
289 event_xy[1] - ofs_size,
290 event_xy[0] + ofs_line,
291 event_xy[1] + ofs_size);
293 event_xy[0] - ofs_size,
294 event_xy[1] - ofs_line,
295 event_xy[0] + ofs_size,
296 event_xy[1] + ofs_line);
363 switch (
area->spacetype) {
489 #ifdef WITH_XR_OPENXR
495 if (ED_view3d_is_region_xr_mirror_active(wm,
area->spacedata.first, region)) {
516 #define SPACE_NAME(space) \
520 switch (
area->spacetype) {
541 return "Unknown Space";
562 void (*draw)(
const struct wmWindow *,
void *),
588 wdc->draw(win, wdc->customdata);
681 if (
G.is_rendering &&
C !=
NULL &&
U.experimental.use_draw_manager_acquire_lock) {
788 rect_tex.
xmin = halfx;
789 rect_tex.
ymin = halfy;
790 rect_tex.
xmax = 1.0f + halfx;
791 rect_tex.
ymax = 1.0f + halfy;
793 float alpha_easing = 1.0f - alpha;
794 alpha_easing = 1.0f - alpha_easing * alpha_easing;
799 rect_geo.
xmin += ofs_x;
800 rect_tex.
xmax *= alpha_easing;
804 rect_geo.
xmax -= ofs_x;
805 rect_tex.
xmin += 1.0f - alpha_easing;
810 const float rectt[4] = {rect_tex.
xmin, rect_tex.
ymin, rect_tex.
xmax, rect_tex.
ymax};
811 const float rectg[4] = {rect_geo.
xmin, rect_geo.
ymin, rect_geo.
xmax, rect_geo.
ymax};
916 bool views_valid =
true;
936 if (use_viewport && views_valid) {
1014 if (region->
overlap ==
false) {
1029 if (!(do_paint_cursor || do_draw_overlay)) {
1035 if (do_draw_overlay) {
1038 if (do_paint_cursor) {
1208 bool do_draw =
false;
1224 #ifdef WITH_XR_OPENXR
1225 wm_region_test_xr_do_draw(wm,
area, region);
1270 #ifndef WITH_XR_OPENXR
struct WorkSpace * CTX_wm_workspace(const bContext *C)
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
void CTX_wm_region_set(bContext *C, struct ARegion *region)
void CTX_wm_menu_set(bContext *C, struct ARegion *menu)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
void CTX_wm_window_set(bContext *C, struct wmWindow *win)
struct ARegion * CTX_wm_region(const bContext *C)
void CTX_wm_area_set(bContext *C, struct ScrArea *area)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
void BKE_image_free_unused_gpu_textures(void)
struct Image * BKE_image_ensure_viewer(struct Main *bmain, int type, const char *name)
struct Depsgraph * BKE_scene_ensure_depsgraph(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int mod_i(int i, int n)
void unit_m4(float m[4][4])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
struct Depsgraph Depsgraph
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
@ AREA_FLAG_ACTIVE_TOOL_UPDATE
#define RGN_ALIGN_ENUM_FROM_MASK(align)
bool ED_node_is_compositor(struct SpaceNode *snode)
void ED_area_update_region_sizes(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *area)
void ED_region_do_layout(struct bContext *C, struct ARegion *region)
float ED_region_blend_alpha(struct ARegion *region)
void ED_region_tag_redraw_partial(struct ARegion *region, const struct rcti *rct, bool rebuild)
void ED_region_tag_redraw_editor_overlays(struct ARegion *region)
#define ED_screen_areas_iter(win, screen, area_name)
void ED_region_tag_redraw_no_rebuild(struct ARegion *region)
void ED_screen_draw_edges(struct wmWindow *win)
void ED_region_do_draw(struct bContext *C, struct ARegion *region)
void ED_screen_ensure_updated(struct wmWindowManager *wm, struct wmWindow *win, struct bScreen *screen)
bool ED_view3d_calc_render_border(const struct Scene *scene, struct Depsgraph *depsgraph, struct View3D *v3d, struct ARegion *region, struct rcti *rect)
GHOST C-API function and type declarations.
GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
bool GHOST_SupportsCursorWarp(void)
void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode *r_mode, GHOST_TAxisFlag *r_axis_flag, int r_bounds[4], bool *r_use_software_cursor)
GHOST_TSuccess GHOST_GetCursorBitmap(GHOST_WindowHandle windowhandle, GHOST_CursorBitmapRef *bitmap)
bool GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
@ GHOST_kWindowStateMinimized
void GPU_batch_set_shader(GPUBatch *batch, GPUShader *shader)
void GPU_batch_draw(GPUBatch *batch)
struct GPUBatch * GPU_batch_preset_quad(void)
void GPU_context_main_lock(void)
void GPU_render_begin(void)
void GPU_context_begin_frame(GPUContext *ctx)
void GPU_context_end_frame(GPUContext *ctx)
void GPU_context_main_unlock(void)
void GPU_render_end(void)
void GPU_render_step(void)
void GPU_debug_group_end(void)
void GPU_debug_group_begin(const char *name)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
void GPU_matrix_pop(void)
#define GPU_matrix_mul(x)
void GPU_matrix_push(void)
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
struct GPUShader GPUShader
void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, const float *value)
GPUShader * GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
void GPU_shader_bind(GPUShader *shader)
@ GPU_SHADER_3D_IMAGE_MODULATE_ALPHA
@ GPU_SHADER_2D_UNIFORM_COLOR
@ GPU_SHADER_2D_IMAGE_RECT_COLOR
int GPU_shader_get_texture_binding(GPUShader *shader, const char *name)
int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin)
@ GPU_BLEND_ALPHA_PREMULT
void GPU_blend(eGPUBlend blend)
void GPU_scissor_test(bool enable)
void GPU_scissor(int x, int y, int width, int height)
struct GPUTexture GPUTexture
void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter)
void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *data)
void GPU_texture_free(GPUTexture *tex)
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter)
void GPU_texture_unbind(GPUTexture *tex)
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
void GPU_texture_bind(GPUTexture *tex, int unit)
void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
GPUTexture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
GPUViewport * GPU_viewport_create(void)
bool GPU_viewport_do_update(GPUViewport *viewport)
GPUViewport * GPU_viewport_stereo_create(void)
void GPU_viewport_free(GPUViewport *viewport)
void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format)
void GPU_viewport_tag_update(GPUViewport *viewport)
void GPU_viewport_unbind(GPUViewport *viewport)
Read Guarded memory(de)allocation.
#define RE_USE_STEREO_VIEWPORT
#define RE_ENGINE_DO_DRAW
void UI_SetTheme(int spacetype, int regionid)
@ WM_GIZMOGROUPTYPE_VR_REDRAWS
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
struct @211::@212 surface
RenderEngineType * RE_engines_find(const char *idname)
bool RE_engine_is_opengl(RenderEngineType *render_type)
void GPU_offscreen_free(GPUOffScreen *ofs)
void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore)
GPUOffScreen * GPU_offscreen_create(int width, int height, bool depth, eGPUTextureFormat format, char err_out[256])
void GPU_backbuffer_bind(eGPUBackBuffer buffer)
void GPU_clear_color(float red, float green, float blue, float alpha)
void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y)
int GPU_offscreen_width(const GPUOffScreen *ofs)
void GPU_offscreen_bind(GPUOffScreen *ofs, bool save)
GPUTexture * GPU_offscreen_color_texture(const GPUOffScreen *ofs)
int GPU_offscreen_height(const GPUOffScreen *ofs)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
void(* draw_overlay)(const struct bContext *C, struct ARegion *region)
void(* layout)(const struct bContext *C, struct ARegion *region)
short do_draw_paintcursor
struct wmDrawBuffer * draw_buffer
struct wmGizmoMap * gizmo_map
struct ARegionType * type
struct ListBase bg_images
GHOST_TAxisFlag wrap_axis
GHOST_TGrabCursorMode mode
struct RenderEngine * render_engine
struct WindowDrawCB * next
struct WindowDrawCB * prev
void(* draw)(const struct wmWindow *, void *)
struct ARegion * active_region
struct GPUViewport * viewport
struct GPUOffScreen * offscreen
struct wmEvent * eventstate
struct Stereo3dFormat * stereo3d_format
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
void wm_drags_draw(bContext *C, wmWindow *win)
static void wm_draw_callbacks(wmWindow *win)
void WM_draw_region_viewport_unbind(ARegion *region)
static void wm_draw_offscreen_texture_parameters(GPUOffScreen *offscreen)
static void wm_draw_region_unbind(ARegion *region)
static bool wm_software_cursor_needed(void)
static bool wm_software_cursor_needed_for_window(const wmWindow *win, struct GrabState *grab_state)
static void wm_software_cursor_motion_clear(void)
static bool wm_region_use_viewport_by_type(short space_type, short region_type)
static void wm_draw_surface(bContext *C, wmSurface *surface)
static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
void WM_draw_region_free(ARegion *region, bool hide)
void WM_redraw_windows(bContext *C)
static void wm_draw_region_buffer_free(ARegion *region)
GPUTexture * wm_draw_region_texture(ARegion *region, int view)
static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region)
void wm_draw_region_blend(ARegion *region, int view, bool blend)
static void wm_draw_update_clear_window(bContext *C, wmWindow *win)
struct WindowDrawCB WindowDrawCB
static void wm_software_cursor_draw(wmWindow *win, const struct GrabState *grab_state)
bool WM_region_use_viewport(ScrArea *area, ARegion *region)
#define SPACE_NAME(space)
static void wm_region_draw_overlay(bContext *C, ScrArea *area, ARegion *region)
static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *area, ARegion *region, eStereoViews sview)
void WM_draw_cb_exit(wmWindow *win, void *handle)
void * WM_draw_cb_activate(wmWindow *win, void(*draw)(const struct wmWindow *, void *), void *customdata)
static void wm_region_test_gizmo_do_draw(bContext *C, ScrArea *area, ARegion *region, bool tag_redraw)
static bool wm_software_cursor_motion_test(const wmWindow *win)
void WM_draw_region_viewport_bind(ARegion *region)
static bool wm_draw_region_bind(bContext *C, ARegion *region, int view)
static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *depsgraph, ScrArea *area, ARegion *region)
static void wm_software_cursor_draw_crosshair(const int event_xy[2])
void wm_draw_region_test(bContext *C, ScrArea *area, ARegion *region)
static struct @1189 g_software_cursor
static void wm_draw_region_buffer_create(ARegion *region, bool stereo, bool use_viewport)
static void wm_draw_region_blit(ARegion *region, int view)
void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(region))
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
static void wm_software_cursor_motion_update(const wmWindow *win)
static void wm_draw_window(bContext *C, wmWindow *win)
static void wm_software_cursor_draw_bitmap(const int event_xy[2], const GHOST_CursorBitmapRef *bitmap)
void WM_draw_region_viewport_ensure(ARegion *region, short space_type)
void wm_draw_update(bContext *C)
static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win)
static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
GPUViewport * WM_draw_region_get_bound_viewport(ARegion *region)
static const char * wm_area_name(ScrArea *area)
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(region))
void WM_report(eReportType type, const char *message)
void wm_gesture_draw(wmWindow *win)
bool WM_gizmo_group_type_poll(const bContext *C, const wmGizmoGroupType *gzgt)
const ListBase * WM_gizmomap_group_list(wmGizmoMap *gzmap)
void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
void wm_stereo3d_draw_topbottom(wmWindow *win, int view)
void wmViewport(const rcti *winrct)
void wmWindowViewport(wmWindow *win)
void wm_surface_clear_drawable(void)
void wm_surface_make_drawable(wmSurface *surface)
void wm_surfaces_iter(bContext *C, void(*cb)(bContext *C, wmSurface *))
int WM_window_pixels_y(const wmWindow *win)
void wm_window_swap_buffers(wmWindow *win)
Push rendered buffer to the screen.
void wm_window_clear_drawable(wmWindowManager *wm)
bScreen * WM_window_get_active_screen(const wmWindow *win)
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
int WM_window_pixels_x(const wmWindow *win)
Scene * WM_window_get_active_scene(const wmWindow *win)
void wm_cursor_position_get(wmWindow *win, int *r_x, int *r_y)