Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_draw.c
| Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | const rctf combined = { | ||||
| .ymin = vertical ? MIN2(sa1->totrct.ymin, sa2->totrct.ymin) : | .ymin = vertical ? MIN2(sa1->totrct.ymin, sa2->totrct.ymin) : | ||||
| MAX2(sa1->totrct.ymin, sa2->totrct.ymin), | MAX2(sa1->totrct.ymin, sa2->totrct.ymin), | ||||
| .ymax = vertical ? MAX2(sa1->totrct.ymax, sa2->totrct.ymax) : | .ymax = vertical ? MAX2(sa1->totrct.ymax, sa2->totrct.ymax) : | ||||
| MIN2(sa1->totrct.ymax, sa2->totrct.ymax), | MIN2(sa1->totrct.ymax, sa2->totrct.ymax), | ||||
| }; | }; | ||||
| uint pos_id = GPU_vertformat_attr_add( | uint pos_id = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| /* Highlight source (sa1) within combined area. */ | /* Highlight source (sa1) within combined area. */ | ||||
| immUniformColor4fv((const float[4]){1.0f, 1.0f, 1.0f, 0.10f}); | immUniformColor4fv((const float[4]){1.0f, 1.0f, 1.0f, 0.10f}); | ||||
| immRectf(pos_id, | immRectf(pos_id, | ||||
| MAX2(sa1->totrct.xmin, combined.xmin), | MAX2(sa1->totrct.xmin, combined.xmin), | ||||
| MAX2(sa1->totrct.ymin, combined.ymin), | MAX2(sa1->totrct.ymin, combined.ymin), | ||||
| MIN2(sa1->totrct.xmax, combined.xmax), | MIN2(sa1->totrct.xmax, combined.xmax), | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | void screen_draw_join_highlight(ScrArea *sa1, ScrArea *sa2) | ||||
| /* Outline the combined area. */ | /* Outline the combined area. */ | ||||
| UI_draw_roundbox_corner_set(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| UI_draw_roundbox_4fv(&combined, false, 7 * U.pixelsize, (float[4]){1.0f, 1.0f, 1.0f, 0.8f}); | UI_draw_roundbox_4fv(&combined, false, 7 * U.pixelsize, (float[4]){1.0f, 1.0f, 1.0f, 0.8f}); | ||||
| } | } | ||||
| void screen_draw_split_preview(ScrArea *area, const eScreenAxis dir_axis, const float fac) | void screen_draw_split_preview(ScrArea *area, const eScreenAxis dir_axis, const float fac) | ||||
| { | { | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* Split-point. */ | /* Split-point. */ | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| immUniformColor4ub(255, 255, 255, 100); | immUniformColor4ub(255, 255, 255, 100); | ||||
| immBegin(GPU_PRIM_LINES, 2); | immBegin(GPU_PRIM_LINES, 2); | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
| static void screen_preview_draw_areas(const bScreen *screen, | static void screen_preview_draw_areas(const bScreen *screen, | ||||
| const float scale[2], | const float scale[2], | ||||
| const float col[4], | const float col[4], | ||||
| const float ofs_between_areas) | const float ofs_between_areas) | ||||
| { | { | ||||
| const float ofs_h = ofs_between_areas * 0.5f; | const float ofs_h = ofs_between_areas * 0.5f; | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor4fv(col); | immUniformColor4fv(col); | ||||
| LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { | ||||
| rctf rect = { | rctf rect = { | ||||
| .xmin = area->totrct.xmin * scale[0] + ofs_h, | .xmin = area->totrct.xmin * scale[0] + ofs_h, | ||||
| .xmax = area->totrct.xmax * scale[0] - ofs_h, | .xmax = area->totrct.xmax * scale[0] - ofs_h, | ||||
| .ymin = area->totrct.ymin * scale[1] + ofs_h, | .ymin = area->totrct.ymin * scale[1] + ofs_h, | ||||
| .ymax = area->totrct.ymax * scale[1] - ofs_h, | .ymax = area->totrct.ymax * scale[1] - ofs_h, | ||||
| ▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines | |||||