35#define CORNER_RESOLUTION 3
47 exter[0] = roundf(exter[0]);
48 exter[1] = roundf(exter[1]);
55 const float line_width = 0.2f;
84 static blender::gpu::Batch *screen_edges_batch =
nullptr;
86 if (screen_edges_batch ==
nullptr) {
94 for (
int corner = 0; corner < 4; corner++) {
109 return screen_edges_batch;
112#undef CORNER_RESOLUTION
115 int sizex,
int sizey,
short x1,
short y1,
short x2,
short y2,
float edge_thickness)
118 BLI_rctf_init(&rect,
float(x1),
float(x2),
float(y1),
float(y2));
121 if (x2 >= sizex - 1) {
122 rect.
xmax += edge_thickness * 0.5f;
127 rect.
xmin -= edge_thickness * 0.5f;
131 if (y2 >= sizey - 1) {
132 rect.
ymax += edge_thickness * 0.5f;
137 rect.
ymin -= edge_thickness * 0.5f;
151 short x1 = area->v1->vec.x;
152 short y1 = area->v1->vec.y;
153 short x2 = area->v3->vec.x;
154 short y2 = area->v3->vec.y;
162 screen->do_draw =
false;
172 ARegion *region = screen->active_region;
173 ScrArea *active_area =
nullptr;
199 active_area =
nullptr;
205 float col[4], corner_scale, edge_thickness;
206 int verts_per_corner = 0;
228 if (
U.pixelsize <= 1.0f) {
234 corner_scale =
U.pixelsize * 8.0f;
235 edge_thickness = corner_scale * 0.21f;
257 rctf rectf2 = {
float(area->totrct.xmin) + offset - 1.0f,
258 float(area->totrct.xmax) - offset + 1.5f,
259 float(area->totrct.ymin) + offset - 1.0f,
260 float(area->totrct.ymax) - offset + 1.0f};
266 (area == active_area) ? outline2 : outline1,
273 if (
U.pixelsize <= 1.0f) {
280 rctf rect = {SHRT_MAX, SHRT_MIN, SHRT_MAX, SHRT_MIN};
283 if (edge->v1->editflag && edge->v2->editflag) {
304 float inner[4] = {1.0f, 1.0f, 1.0f, 0.7f};
305 float outline[4] = {0.0f, 0.0f, 0.0f, 0.8f};
308 &rect, inner,
nullptr, 1.0f, outline, 2.0f *
U.pixelsize, 2.5f *
U.pixelsize);
317 float col_fg[4], col_bg[4];
324 const float margin = scale * 4.0f;
326 const float icon_gap = scale * 3.0f;
327 const float line_gap = scale * 5.0f;
332 const float width = margin + std::max(line1_len, line2_len + icon_width + icon_gap) + margin;
333 const float height = margin + lheight + line_gap + lheight + margin;
341 rect.
xmax = left + width;
343 rect.
ymin = top - height;
348 top - height + margin + (1.0f * scale),
364 left + margin + icon_width + icon_gap,
365 top - height + margin - descent,
374 float darken[4] = {0.0f, 0.0f, 0.0f, 0.7f};
403 if (offset1 < 0 || offset2 > 0) {
445 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
446 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f};
458 const float rad = 7 *
U.pixelsize;
466 for (
int a = 0; a < 4; a++) {
477 for (
int a = 0; a < 4; a++) {
488 for (
int a = 0; a < 4; a++) {
499 for (
int a = 0; a < 4; a++) {
510 for (
int a = 0; a < 4; a++) {
527 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
528 float inner[4] = {1.0f, 1.0f, 1.0f, 0.1f};
532 float half_line_width = 2.0f *
U.pixelsize;
543 split = std::min(dest.
xmin + target->winx * (1.0f - factor),
545 dest.
xmin = split + half_line_width;
546 remainder.
xmax = split - half_line_width;
550 split = std::max(dest.
xmax - target->winx * (1.0f - factor),
552 dest.
xmax = split - half_line_width;
553 remainder.
xmin = split + half_line_width;
557 split = std::min(dest.
ymin + target->winy * (1.0f - factor),
559 dest.
ymin = split + half_line_width;
560 remainder.
ymax = split - half_line_width;
564 split = std::max(dest.
ymax - target->winy * (1.0f - factor),
566 dest.
ymax = split - half_line_width;
567 remainder.
ymin = split + half_line_width;
577 dest.
xmin = split - half_line_width;
578 dest.
xmax = split + half_line_width;
581 dest.
ymin = split - half_line_width;
582 dest.
ymax = split + half_line_width;
596 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
597 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f};
605 if (factor < 0.0001 || factor > 0.9999) {
611 float x = (1 - factor) * rect.
xmin + factor * rect.
xmax;
612 float y = (1 - factor) * rect.
ymin + factor * rect.
ymax;
613 x = std::clamp(x, rect.
xmin, rect.
xmax);
614 y = std::clamp(y, rect.
ymin, rect.
ymax);
615 float half_line_width = 2.0f *
U.pixelsize;
629 rect.
ymin = y + half_line_width;
630 rect.
ymax = area->totrct.ymax;
633 rect.
xmin = x + half_line_width;
634 rect.
xmax = area->totrct.xmax;
645 rect.
ymin = y - half_line_width;
646 rect.
ymax = y + half_line_width;
649 rect.
xmin = x - half_line_width;
650 rect.
xmax = x + half_line_width;
ScrArea ScrArea * BKE_screen_find_area_xy(const bScreen *screen, int spacetype, const int xy[2]) ATTR_NONNULL(1
void BLF_size(int fontid, float size)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_color4fv(int fontid, const float rgba[4])
#define BLF_DRAW_STR_DUMMY_MAX
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_position(int fontid, float x, float y, float z)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_INLINE bool BLI_listbase_is_single(const struct ListBase *lb)
MINLINE float max_ff(float a, float b)
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init_minmax(struct rcti *rect)
void BLI_rcti_pad(struct rcti *rect, int pad_x, int pad_y)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2])
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
int ED_area_icon(const ScrArea *area)
blender::StringRefNull ED_area_name(const ScrArea *area)
static void split(const char *text, const char *seps, char ***str, int *count)
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, eGPUBatchFlag owns_flag)
#define GPU_batch_uniform_1f(batch, name, x)
void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, eGPUBuiltinShader shader_id)
void GPU_batch_draw(blender::gpu::Batch *batch)
#define GPU_batch_uniform_4fv(batch, name, val)
#define GPU_batch_uniform_1i(batch, name, x)
void gpu_batch_presets_register(blender::gpu::Batch *preset_batch)
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_AREA_BORDERS
void GPU_blend(eGPUBlend blend)
void GPU_scissor_test(bool enable)
void GPU_scissor(int x, int y, int width, int height)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_attr_set(blender::gpu::VertBuf *, uint a_idx, uint v_idx, const void *data)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
void UI_draw_roundbox_4fv_ex(const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
#define UI_DEFAULT_TOOLTIP_POINTS
void UI_draw_roundbox_corner_set(int type)
#define UI_FSTYLE_TOOLTIP
#define UI_NO_ICON_OVERLAY_TEXT
void UI_icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], bool mono_border, const IconTextOverlay *text_overlay, const bool inverted=false)
#define ICON_DEFAULT_WIDTH
@ TH_EDITOR_OUTLINE_ACTIVE
void UI_GetThemeColor4fv(int colorid, float col[4])
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void screen_draw_dock_preview(ScrArea *source, ScrArea *target, AreaDockTarget dock_target, float factor, int x, int y)
static void drawscredge_area(ScrArea *area, int sizex, int sizey, float edge_thickness)
Screen edges drawing.
static void rounded_corners(rctf rect, float color[4], int corners)
void screen_draw_split_preview(ScrArea *area, const eScreenAxis dir_axis, const float factor)
static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, float edge_thickness)
void ED_screen_draw_edges(wmWindow *win)
#define CORNER_RESOLUTION
static void screen_draw_area_closed(int xmin, int xmax, int ymin, int ymax)
void screen_draw_move_highlight(bScreen *screen, eScreenAxis dir_axis)
void screen_draw_join_highlight(const wmWindow *win, ScrArea *sa1, ScrArea *sa2, eScreenDir dir)
static void do_vert_pair(blender::gpu::VertBuf *vbo, uint pos, uint *vidx, int corner, int i)
static void screen_draw_area_drag_tip(int x, int y, const ScrArea *source, const std::string &hint)
static blender::gpu::Batch * batch_screen_edges_get(int *corner_len)
void area_getoffsets(ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2)
AZone * ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
#define SCREEN_DIR_IS_VERTICAL(dir)
uiWidgetColors wcol_tooltip
struct wmEvent * eventstate
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)