Blender V4.3
screen_draw.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "ED_screen.hh"
10#include "ED_screen_types.hh"
11
12#include "GPU_batch_presets.hh"
13#include "GPU_immediate.hh"
14#include "GPU_platform.hh"
15#include "GPU_state.hh"
16
17#include "BKE_global.hh"
18#include "BKE_screen.hh"
19
20#include "BLF_api.hh"
21
22#include "BLI_listbase.h"
23#include "BLI_math_vector.hh"
24#include "BLI_rect.h"
25
26#include "BLT_translation.hh"
27
28#include "WM_api.hh"
29
30#include "UI_interface.hh"
31#include "UI_resources.hh"
32
33#include "screen_intern.hh"
34
35#define CORNER_RESOLUTION 3
36
37static void do_vert_pair(blender::gpu::VertBuf *vbo, uint pos, uint *vidx, int corner, int i)
38{
39 float inter[2];
40 inter[0] = cosf(corner * M_PI_2 + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f)));
41 inter[1] = sinf(corner * M_PI_2 + (i * M_PI_2 / (CORNER_RESOLUTION - 1.0f)));
42
43 /* Snap point to edge */
44 float div = 1.0f / max_ff(fabsf(inter[0]), fabsf(inter[1]));
45 float exter[2];
46 mul_v2_v2fl(exter, inter, div);
47 exter[0] = roundf(exter[0]);
48 exter[1] = roundf(exter[1]);
49
50 if (i == 0 || i == (CORNER_RESOLUTION - 1)) {
51 copy_v2_v2(inter, exter);
52 }
53
54 /* Line width is 20% of the entire corner size. */
55 const float line_width = 0.2f; /* Keep in sync with shader */
56 mul_v2_fl(inter, 1.0f - line_width);
57 mul_v2_fl(exter, 1.0f + line_width);
58
59 switch (corner) {
60 case 0:
61 add_v2_v2(inter, blender::float2{-1.0f, -1.0f});
62 add_v2_v2(exter, blender::float2{-1.0f, -1.0f});
63 break;
64 case 1:
65 add_v2_v2(inter, blender::float2{1.0f, -1.0f});
66 add_v2_v2(exter, blender::float2{1.0f, -1.0f});
67 break;
68 case 2:
69 add_v2_v2(inter, blender::float2{1.0f, 1.0f});
70 add_v2_v2(exter, blender::float2{1.0f, 1.0f});
71 break;
72 case 3:
73 add_v2_v2(inter, blender::float2{-1.0f, 1.0f});
74 add_v2_v2(exter, blender::float2{-1.0f, 1.0f});
75 break;
76 }
77
78 GPU_vertbuf_attr_set(vbo, pos, (*vidx)++, inter);
79 GPU_vertbuf_attr_set(vbo, pos, (*vidx)++, exter);
80}
81
82static blender::gpu::Batch *batch_screen_edges_get(int *corner_len)
83{
84 static blender::gpu::Batch *screen_edges_batch = nullptr;
85
86 if (screen_edges_batch == nullptr) {
89
92
93 uint vidx = 0;
94 for (int corner = 0; corner < 4; corner++) {
95 for (int c = 0; c < CORNER_RESOLUTION; c++) {
96 do_vert_pair(vbo, pos, &vidx, corner, c);
97 }
98 }
99 /* close the loop */
100 do_vert_pair(vbo, pos, &vidx, 0, 0);
101
102 screen_edges_batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, nullptr, GPU_BATCH_OWNS_VBO);
103 gpu_batch_presets_register(screen_edges_batch);
104 }
105
106 if (corner_len) {
107 *corner_len = CORNER_RESOLUTION * 2;
108 }
109 return screen_edges_batch;
110}
111
112#undef CORNER_RESOLUTION
113
115 int sizex, int sizey, short x1, short y1, short x2, short y2, float edge_thickness)
116{
117 rctf rect;
118 BLI_rctf_init(&rect, float(x1), float(x2), float(y1), float(y2));
119
120 /* right border area */
121 if (x2 >= sizex - 1) {
122 rect.xmax += edge_thickness * 0.5f;
123 }
124
125 /* left border area */
126 if (x1 <= 0) { /* otherwise it draws the emboss of window over */
127 rect.xmin -= edge_thickness * 0.5f;
128 }
129
130 /* top border area */
131 if (y2 >= sizey - 1) {
132 rect.ymax += edge_thickness * 0.5f;
133 }
134
135 /* bottom border area */
136 if (y1 <= 0) {
137 rect.ymin -= edge_thickness * 0.5f;
138 }
139
140 blender::gpu::Batch *batch = batch_screen_edges_get(nullptr);
142 GPU_batch_uniform_4fv(batch, "rect", (float *)&rect);
144}
145
149static void drawscredge_area(ScrArea *area, int sizex, int sizey, float edge_thickness)
150{
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;
155
156 drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, edge_thickness);
157}
158
160{
162 screen->do_draw = false;
163
164 if (screen->state == SCREENFULL) {
165 return;
166 }
167
168 if (screen->temp && BLI_listbase_is_single(&screen->areabase)) {
169 return;
170 }
171
172 ARegion *region = screen->active_region;
173 ScrArea *active_area = nullptr;
174
175 if (region) {
176 /* Find active area from active region. */
177 const int pos[2] = {BLI_rcti_cent_x(&region->winrct), BLI_rcti_cent_y(&region->winrct)};
178 active_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, pos);
179 }
180
181 if (!active_area) {
182 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
183 AZone *zone = ED_area_actionzone_find_xy(area, win->eventstate->xy);
184 /* Get area from action zone, if not scroll-bar. */
185 if (zone && zone->type != AZONE_REGION_SCROLL) {
186 active_area = area;
187 break;
188 }
189 }
190 }
191
192 if (!active_area && G.moving & G_TRANSFORM_WM) {
193 active_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, win->eventstate->xy);
194 /* We don't want an active area if at a border edge. */
195 if (active_area) {
196 rcti rect = active_area->totrct;
198 if (!BLI_rcti_isect_pt_v(&rect, win->eventstate->xy)) {
199 active_area = nullptr;
200 }
201 }
202 }
203
204 const blender::int2 win_size = WM_window_native_pixel_size(win);
205 float col[4], corner_scale, edge_thickness;
206 int verts_per_corner = 0;
207
208 rcti scissor_rect;
209 BLI_rcti_init_minmax(&scissor_rect);
210 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
211 BLI_rcti_do_minmax_v(&scissor_rect, blender::int2{area->v1->vec.x, area->v1->vec.y});
212 BLI_rcti_do_minmax_v(&scissor_rect, blender::int2{area->v3->vec.x, area->v3->vec.y});
213 }
214
216 /* For some reason, on linux + Intel UHD Graphics 620 the driver
217 * hangs if we don't flush before this. (See #57455) */
218 GPU_flush();
219 }
220
221 GPU_scissor(scissor_rect.xmin,
222 scissor_rect.ymin,
223 BLI_rcti_size_x(&scissor_rect) + 1,
224 BLI_rcti_size_y(&scissor_rect) + 1);
225
226 /* It seems that all areas gets smaller when pixelsize is > 1.
227 * So in order to avoid missing pixels we just disable de scissors. */
228 if (U.pixelsize <= 1.0f) {
229 GPU_scissor_test(true);
230 }
231
233 col[3] = 1.0f;
234 corner_scale = U.pixelsize * 8.0f;
235 edge_thickness = corner_scale * 0.21f;
236
238
239 blender::gpu::Batch *batch = batch_screen_edges_get(&verts_per_corner);
241 GPU_batch_uniform_1i(batch, "cornerLen", verts_per_corner);
242 GPU_batch_uniform_1f(batch, "scale", corner_scale);
244
245 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
246 drawscredge_area(area, win_size[0], win_size[1], edge_thickness);
247 }
248
249 float outline1[4];
250 float outline2[4];
254 const float offset = UI_SCALE_FAC * 1.34f;
255
256 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
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};
261
263 nullptr,
264 nullptr,
265 1.0f,
266 (area == active_area) ? outline2 : outline1,
267 U.pixelsize,
268 6.0f * U.pixelsize);
269 }
270
272
273 if (U.pixelsize <= 1.0f) {
274 GPU_scissor_test(false);
275 }
276}
277
279{
280 rctf rect = {SHRT_MAX, SHRT_MIN, SHRT_MAX, SHRT_MIN};
281
282 LISTBASE_FOREACH (const ScrEdge *, edge, &screen->edgebase) {
283 if (edge->v1->editflag && edge->v2->editflag) {
284 if (dir_axis == SCREEN_AXIS_H) {
285 rect.xmin = std::min({rect.xmin, float(edge->v1->vec.x), float(edge->v2->vec.x)});
286 rect.xmax = std::max({rect.xmax, float(edge->v1->vec.x), float(edge->v2->vec.x)});
287 rect.ymin = rect.ymax = float(edge->v1->vec.y);
288 }
289 else {
290 rect.ymin = std::min({rect.ymin, float(edge->v1->vec.y), float(edge->v2->vec.y)});
291 rect.ymax = std::max({rect.ymax, float(edge->v1->vec.y), float(edge->v2->vec.y)});
292 rect.xmin = rect.xmax = float(edge->v1->vec.x);
293 }
294 };
295 }
296
297 if (dir_axis == SCREEN_AXIS_H) {
298 BLI_rctf_pad(&rect, 0.0f, 2.5f * U.pixelsize);
299 }
300 else {
301 BLI_rctf_pad(&rect, 2.5f * U.pixelsize, 0.0f);
302 }
303
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);
309}
310
311static void screen_draw_area_drag_tip(int x, int y, const ScrArea *source, const std::string &hint)
312{
313 const char *area_name = IFACE_(ED_area_name(source).c_str());
314 const uiFontStyle *fstyle = UI_FSTYLE_TOOLTIP;
315 const bTheme *btheme = UI_GetTheme();
316 const uiWidgetColors *wcol = &btheme->tui.wcol_tooltip;
317 float col_fg[4], col_bg[4];
318 rgba_uchar_to_float(col_fg, wcol->text);
319 rgba_uchar_to_float(col_bg, wcol->inner);
320
321 float scale = fstyle->points * UI_SCALE_FAC / UI_DEFAULT_TOOLTIP_POINTS;
323
324 const float margin = scale * 4.0f;
325 const float icon_width = (scale * ICON_DEFAULT_WIDTH / 1.4f);
326 const float icon_gap = scale * 3.0f;
327 const float line_gap = scale * 5.0f;
328 const int lheight = BLF_height_max(fstyle->uifont_id);
329 const int descent = BLF_descender(fstyle->uifont_id);
330 const float line1_len = BLF_width(fstyle->uifont_id, hint.c_str(), hint.size());
331 const float line2_len = BLF_width(fstyle->uifont_id, area_name, BLF_DRAW_STR_DUMMY_MAX);
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;
334
335 /* Position of this hint relative to the mouse position. */
336 const int left = x + int(5.0f * UI_SCALE_FAC);
337 const int top = y - int(7.0f * UI_SCALE_FAC);
338
339 rctf rect;
340 rect.xmin = left;
341 rect.xmax = left + width;
342 rect.ymax = top;
343 rect.ymin = top - height;
345 UI_draw_roundbox_4fv(&rect, true, wcol->roundness * U.widget_unit, col_bg);
346
347 UI_icon_draw_ex(left + margin,
348 top - height + margin + (1.0f * scale),
349 ED_area_icon(source),
350 1.4f / scale,
351 1.0f,
352 0.0f,
353 wcol->text,
354 true,
356
358 BLF_color4fv(fstyle->uifont_id, col_fg);
359
360 BLF_position(fstyle->uifont_id, left + margin, top - margin - lheight + (2.0f * scale), 0.0f);
361 BLF_draw(fstyle->uifont_id, hint.c_str(), hint.size());
362
363 BLF_position(fstyle->uifont_id,
364 left + margin + icon_width + icon_gap,
365 top - height + margin - descent,
366 0.0f);
367 BLF_draw(fstyle->uifont_id, area_name, BLF_DRAW_STR_DUMMY_MAX);
368}
369
370static void screen_draw_area_closed(int xmin, int xmax, int ymin, int ymax)
371{
372 /* Darken the area. */
373 rctf rect = {float(xmin), float(xmax), float(ymin), float(ymax)};
374 float darken[4] = {0.0f, 0.0f, 0.0f, 0.7f};
376 UI_draw_roundbox_4fv_ex(&rect, darken, nullptr, 1.0f, nullptr, U.pixelsize, 6 * U.pixelsize);
377}
378
380{
381 if (dir == SCREEN_DIR_NONE || !sa2) {
382 /* Darken source if docking. Done here because it might be a different window. */
384 sa1->totrct.xmin, sa1->totrct.xmax, sa1->totrct.ymin, sa1->totrct.ymax);
385 return;
386 }
387
388 /* Rect of the combined areas. */
389 const bool vertical = SCREEN_DIR_IS_VERTICAL(dir);
390 rctf combined{};
391 combined.xmin = vertical ? std::max(sa1->totrct.xmin, sa2->totrct.xmin) :
392 std::min(sa1->totrct.xmin, sa2->totrct.xmin);
393 combined.xmax = vertical ? std::min(sa1->totrct.xmax, sa2->totrct.xmax) :
394 std::max(sa1->totrct.xmax, sa2->totrct.xmax);
395 combined.ymin = vertical ? std::min(sa1->totrct.ymin, sa2->totrct.ymin) :
396 std::max(sa1->totrct.ymin, sa2->totrct.ymin);
397 combined.ymax = vertical ? std::max(sa1->totrct.ymax, sa2->totrct.ymax) :
398 std::min(sa1->totrct.ymax, sa2->totrct.ymax);
399
400 int offset1;
401 int offset2;
402 area_getoffsets(sa1, sa2, dir, &offset1, &offset2);
403 if (offset1 < 0 || offset2 > 0) {
404 /* Show partial areas that will be closed. */
405 if (vertical) {
406 if (sa1->totrct.xmin < combined.xmin) {
408 sa1->totrct.xmin, combined.xmin, sa1->totrct.ymin, sa1->totrct.ymax);
409 }
410 if (sa2->totrct.xmin < combined.xmin) {
412 sa2->totrct.xmin, combined.xmin, sa2->totrct.ymin, sa2->totrct.ymax);
413 }
414 if (sa1->totrct.xmax > combined.xmax) {
416 combined.xmax, sa1->totrct.xmax, sa1->totrct.ymin, sa1->totrct.ymax);
417 }
418 if (sa2->totrct.xmax > combined.xmax) {
420 combined.xmax, sa2->totrct.xmax, sa2->totrct.ymin, sa2->totrct.ymax);
421 }
422 }
423 else {
424 if (sa1->totrct.ymin < combined.ymin) {
426 sa1->totrct.xmin, sa1->totrct.xmax, sa1->totrct.ymin, combined.ymin);
427 }
428 if (sa2->totrct.ymin < combined.ymin) {
430 sa2->totrct.xmin, sa2->totrct.xmax, sa2->totrct.ymin, combined.ymin);
431 }
432 if (sa1->totrct.ymax > combined.ymax) {
434 sa1->totrct.xmin, sa1->totrct.xmax, combined.ymax, sa1->totrct.ymax);
435 }
436 if (sa2->totrct.ymax > combined.ymax) {
438 sa2->totrct.xmin, sa2->totrct.xmax, combined.ymax, sa2->totrct.ymax);
439 }
440 }
441 }
442
443 /* Outline the combined area. */
445 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
446 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f};
447 UI_draw_roundbox_4fv_ex(&combined, inner, nullptr, 1.0f, outline, U.pixelsize, 6 * U.pixelsize);
448
450 win->eventstate->xy[0], win->eventstate->xy[1], sa1, IFACE_("Join Areas"));
451}
452
453static void rounded_corners(rctf rect, float color[4], int corners)
454{
457
458 const float rad = 7 * U.pixelsize;
459
460 float vec[4][2] = {
461 {0.195, 0.02},
462 {0.55, 0.169},
463 {0.831, 0.45},
464 {0.98, 0.805},
465 };
466 for (int a = 0; a < 4; a++) {
467 mul_v2_fl(vec[a], rad);
468 }
469
471 immUniformColor4fv(color);
472
473 if (corners & UI_CNR_TOP_LEFT) {
475 immVertex2f(pos, rect.xmin - 1, rect.ymax);
476 immVertex2f(pos, rect.xmin, rect.ymax - rad);
477 for (int a = 0; a < 4; a++) {
478 immVertex2f(pos, rect.xmin + vec[a][1], rect.ymax - rad + vec[a][0]);
479 }
480 immVertex2f(pos, rect.xmin + rad, rect.ymax);
481 immEnd();
482 }
483
484 if (corners & UI_CNR_TOP_RIGHT) {
486 immVertex2f(pos, rect.xmax + 1, rect.ymax);
487 immVertex2f(pos, rect.xmax - rad, rect.ymax);
488 for (int a = 0; a < 4; a++) {
489 immVertex2f(pos, rect.xmax - rad + vec[a][0], rect.ymax - vec[a][1]);
490 }
491 immVertex2f(pos, rect.xmax, rect.ymax - rad);
492 immEnd();
493 }
494
495 if (corners & UI_CNR_BOTTOM_RIGHT) {
497 immVertex2f(pos, rect.xmax + 1, rect.ymin);
498 immVertex2f(pos, rect.xmax, rect.ymin + rad);
499 for (int a = 0; a < 4; a++) {
500 immVertex2f(pos, rect.xmax - vec[a][1], rect.ymin + rad - vec[a][0]);
501 }
502 immVertex2f(pos, rect.xmax - rad, rect.ymin);
503 immEnd();
504 }
505
506 if (corners & UI_CNR_BOTTOM_LEFT) {
508 immVertex2f(pos, rect.xmin - 1, rect.ymin);
509 immVertex2f(pos, rect.xmin + rad, rect.ymin);
510 for (int a = 0; a < 4; a++) {
511 immVertex2f(pos, rect.xmin + rad - vec[a][0], rect.ymin + vec[a][1]);
512 }
513 immVertex2f(pos, rect.xmin, rect.ymin + rad);
514 immEnd();
515 }
516
518}
519
521 ScrArea *source, ScrArea *target, AreaDockTarget dock_target, float factor, int x, int y)
522{
523 if (dock_target == AreaDockTarget::None) {
524 return;
525 }
526
527 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
528 float inner[4] = {1.0f, 1.0f, 1.0f, 0.1f};
529 float border[4];
532 float half_line_width = 2.0f * U.pixelsize;
533
534 rctf dest;
535 rctf remainder;
536 BLI_rctf_rcti_copy(&dest, &target->totrct);
537 BLI_rctf_rcti_copy(&remainder, &target->totrct);
538
539 float split;
540 int corners = UI_CNR_NONE;
541
542 if (dock_target == AreaDockTarget::Right) {
543 split = std::min(dest.xmin + target->winx * (1.0f - factor),
544 dest.xmax - AREAMINX * UI_SCALE_FAC);
545 dest.xmin = split + half_line_width;
546 remainder.xmax = split - half_line_width;
548 }
549 else if (dock_target == AreaDockTarget::Left) {
550 split = std::max(dest.xmax - target->winx * (1.0f - factor),
551 dest.xmin + AREAMINX * UI_SCALE_FAC);
552 dest.xmax = split - half_line_width;
553 remainder.xmin = split + half_line_width;
555 }
556 else if (dock_target == AreaDockTarget::Top) {
557 split = std::min(dest.ymin + target->winy * (1.0f - factor),
558 dest.ymax - HEADERY * UI_SCALE_FAC);
559 dest.ymin = split + half_line_width;
560 remainder.ymax = split - half_line_width;
562 }
563 else if (dock_target == AreaDockTarget::Bottom) {
564 split = std::max(dest.ymax - target->winy * (1.0f - factor),
565 dest.ymin + HEADERY * UI_SCALE_FAC);
566 dest.ymax = split - half_line_width;
567 remainder.ymin = split + half_line_width;
569 }
570
571 rounded_corners(dest, border, corners);
572 UI_draw_roundbox_4fv_ex(&dest, inner, nullptr, 1.0f, outline, U.pixelsize, 6 * U.pixelsize);
573
574 if (dock_target != AreaDockTarget::Center) {
575 /* Darken the split position itself. */
577 dest.xmin = split - half_line_width;
578 dest.xmax = split + half_line_width;
579 }
580 else {
581 dest.ymin = split - half_line_width;
582 dest.ymax = split + half_line_width;
583 }
584 UI_draw_roundbox_4fv(&dest, true, 0.0f, border);
585 }
586
588 y,
589 source,
590 dock_target == AreaDockTarget::Center ? IFACE_("Replace Area") :
591 IFACE_("Split Area"));
592}
593
594void screen_draw_split_preview(ScrArea *area, const eScreenAxis dir_axis, const float factor)
595{
596 float outline[4] = {1.0f, 1.0f, 1.0f, 0.4f};
597 float inner[4] = {1.0f, 1.0f, 1.0f, 0.10f};
598 float border[4];
601
602 rctf rect;
603 BLI_rctf_rcti_copy(&rect, &area->totrct);
604
605 if (factor < 0.0001 || factor > 0.9999) {
606 /* Highlight the entire area. */
607 UI_draw_roundbox_4fv_ex(&rect, inner, nullptr, 1.0f, outline, U.pixelsize, 7 * U.pixelsize);
608 return;
609 }
610
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;
616
617 /* Outlined rectangle to left/above split position. */
618 rect.xmax = (dir_axis == SCREEN_AXIS_V) ? x - half_line_width : rect.xmax;
619 rect.ymax = (dir_axis == SCREEN_AXIS_H) ? y - half_line_width : rect.ymax;
620
621 rounded_corners(rect,
622 border,
625 UI_draw_roundbox_4fv_ex(&rect, inner, nullptr, 1.0f, outline, U.pixelsize, 7 * U.pixelsize);
626
627 /* Outlined rectangle to right/below split position. */
628 if (dir_axis == SCREEN_AXIS_H) {
629 rect.ymin = y + half_line_width;
630 rect.ymax = area->totrct.ymax;
631 }
632 else {
633 rect.xmin = x + half_line_width;
634 rect.xmax = area->totrct.xmax;
635 }
636
637 rounded_corners(rect,
638 border,
641 UI_draw_roundbox_4fv_ex(&rect, inner, nullptr, 1.0f, outline, U.pixelsize, 7 * U.pixelsize);
642
643 /* Darken the split position itself. */
644 if (dir_axis == SCREEN_AXIS_H) {
645 rect.ymin = y - half_line_width;
646 rect.ymax = y + half_line_width;
647 }
648 else {
649 rect.xmin = x - half_line_width;
650 rect.xmax = x + half_line_width;
651 }
652 UI_draw_roundbox_4fv(&rect, true, 0.0f, border);
653}
@ G_TRANSFORM_WM
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)
Definition blf.cc:426
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
Definition blf.cc:850
void BLF_color4fv(int fontid, const float rgba[4])
Definition blf.cc:488
#define BLF_DRAW_STR_DUMMY_MAX
Definition BLF_api.hh:393
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Definition blf.cc:568
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
Definition blf.cc:791
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
Definition blf.cc:828
void BLF_position(int fontid, float x, float y, float z)
Definition blf.cc:371
#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)
#define M_PI_2
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)
Definition BLI_rect.h:193
void BLI_rcti_init_minmax(struct rcti *rect)
Definition rct.c:478
void BLI_rcti_pad(struct rcti *rect, int pad_x, int pad_y)
Definition rct.c:623
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
Definition rct.c:408
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:189
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
Definition rct.c:631
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition BLI_rect.h:176
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])
Definition rct.c:490
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition BLI_rect.h:172
unsigned int uint
#define ELEM(...)
#define IFACE_(msgid)
#define HEADERY
@ SCREENFULL
#define AREAMINX
#define SPACE_TYPE_ANY
#define UI_SCALE_FAC
int ED_area_icon(const ScrArea *area)
blender::StringRefNull ED_area_name(const ScrArea *area)
@ AZONE_REGION_SCROLL
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)
Definition gpu_batch.cc:56
#define GPU_batch_uniform_1f(batch, name, x)
Definition GPU_batch.hh:299
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)
Definition GPU_batch.hh:307
@ GPU_BATCH_OWNS_VBO
Definition GPU_batch.hh:42
#define GPU_batch_uniform_1i(batch, name, x)
Definition GPU_batch.hh:297
void gpu_batch_presets_register(blender::gpu::Batch *preset_batch)
void immEnd()
void immUnbindProgram()
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
GPUVertFormat * immVertexFormat()
void immUniformColor4fv(const float rgba[4])
void immBegin(GPUPrimType, uint vertex_len)
@ GPU_DRIVER_ANY
bool GPU_type_matches_ex(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver, eGPUBackendType backend)
@ GPU_OS_UNIX
@ GPU_DEVICE_INTEL_UHD
@ GPU_PRIM_TRI_FAN
@ GPU_PRIM_TRI_STRIP
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_AREA_BORDERS
void GPU_flush()
Definition gpu_state.cc:294
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
void GPU_blend(eGPUBlend blend)
Definition gpu_state.cc:42
void GPU_scissor_test(bool enable)
Definition gpu_state.cc:183
void GPU_scissor(int x, int y, int width, int height)
Definition gpu_state.cc:188
#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)
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
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
@ UI_CNR_BOTTOM_LEFT
@ UI_CNR_BOTTOM_RIGHT
@ UI_CNR_ALL
@ UI_CNR_TOP_LEFT
@ UI_CNR_TOP_RIGHT
@ UI_CNR_NONE
#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_BORDER
@ TH_EDITOR_OUTLINE_ACTIVE
@ TH_EDITOR_OUTLINE
void UI_GetThemeColor4fv(int colorid, float col[4])
bTheme * UI_GetTheme()
unsigned int U
Definition btGjkEpa3.h:78
#define sinf(x)
#define cosf(x)
#define fabsf(x)
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
struct @620::@622 batch
uint col
uint top
format
static int left
#define G(x, y, z)
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)
#define BORDERPADDING
AZone * ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
eScreenAxis
@ SCREEN_AXIS_V
@ SCREEN_AXIS_H
#define SCREEN_DIR_IS_VERTICAL(dir)
eScreenDir
@ SCREEN_DIR_NONE
AreaDockTarget
uiWidgetColors wcol_tooltip
float xmax
float xmin
float ymax
float ymin
int ymin
int ymax
int xmin
int xmax
unsigned char inner[4]
unsigned char text[4]
int xy[2]
Definition WM_types.hh:726
struct wmEvent * eventstate
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)