Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_info/textview.c
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | static void textview_draw_sel(const char *str, | ||||
| if (sel[0] <= str_len_draw && sel[1] >= 0) { | if (sel[0] <= str_len_draw && sel[1] >= 0) { | ||||
| const int sta = BLI_str_utf8_offset_to_column(str, max_ii(sel[0], 0)); | const int sta = BLI_str_utf8_offset_to_column(str, max_ii(sel[0], 0)); | ||||
| const int end = BLI_str_utf8_offset_to_column(str, min_ii(sel[1], str_len_draw)); | const int end = BLI_str_utf8_offset_to_column(str, min_ii(sel[1], str_len_draw)); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor4ubv(bg_sel); | immUniformColor4ubv(bg_sel); | ||||
| immRecti(pos, xy[0] + (cwidth * sta), xy[1] + lheight, xy[0] + (cwidth * end), xy[1]); | immRecti(pos, xy[0] + (cwidth * sta), xy[1] + lheight, xy[0] + (cwidth * end), xy[1]); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | static bool textview_draw_string(TextViewDrawState *tds, | ||||
| /* Invert and swap for wrapping. */ | /* Invert and swap for wrapping. */ | ||||
| tds->sel[0] = str_len - sel_orig[1]; | tds->sel[0] = str_len - sel_orig[1]; | ||||
| tds->sel[1] = str_len - sel_orig[0]; | tds->sel[1] = str_len - sel_orig[0]; | ||||
| if (bg) { | if (bg) { | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor4ubv(bg); | immUniformColor4ubv(bg); | ||||
| immRecti(pos, tds->draw_rect_outer->xmin, line_bottom, tds->draw_rect_outer->xmax, line_top); | immRecti(pos, tds->draw_rect_outer->xmin, line_bottom, tds->draw_rect_outer->xmax, line_top); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| if (icon_bg) { | if (icon_bg) { | ||||
| float col[4]; | float col[4]; | ||||
| int bg_size = UI_DPI_ICON_SIZE * 1.2; | int bg_size = UI_DPI_ICON_SIZE * 1.2; | ||||
| ▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines | |||||