Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/area.c
| Show First 20 Lines • Show All 3,331 Lines • ▼ Show 20 Lines | const rcti *ED_region_visible_rect(ARegion *ar) | ||||
| if (rect->xmin == 0 && rect->ymin == 0 && rect->xmax == 0 && rect->ymax == 0) { | if (rect->xmin == 0 && rect->ymin == 0 && rect->xmax == 0 && rect->ymax == 0) { | ||||
| region_visible_rect_calc(ar, rect); | region_visible_rect_calc(ar, rect); | ||||
| } | } | ||||
| return rect; | return rect; | ||||
| } | } | ||||
| /* Cache display helpers */ | /* Cache display helpers */ | ||||
| void ED_region_cache_draw_background(const ARegion *ar) | void ED_region_cache_draw_background(ARegion *ar) | ||||
| { | { | ||||
| /* Local coordinate visible rect inside region, to accommodate overlapping ui. */ | |||||
sergey: Same as above. | |||||
| const rcti *rect_visible = ED_region_visible_rect(ar); | |||||
| const int region_bottom = rect_visible->ymin; | |||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| immUniformColor4ub(128, 128, 255, 64); | immUniformColor4ub(128, 128, 255, 64); | ||||
| immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC); | immRecti(pos, 0, region_bottom, ar->winx, region_bottom + 8 * UI_DPI_FAC); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y) | void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y) | ||||
| { | { | ||||
| uiStyle *style = UI_style_get(); | uiStyle *style = UI_style_get(); | ||||
| int fontid = style->widget.uifont_id; | int fontid = style->widget.uifont_id; | ||||
| char numstr[32]; | char numstr[32]; | ||||
| Show All 13 Lines | void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y) | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| UI_FontThemeColor(fontid, TH_TEXT); | UI_FontThemeColor(fontid, TH_TEXT); | ||||
| BLF_position(fontid, x + 2.0f, y + 2.0f, 0.0f); | BLF_position(fontid, x + 2.0f, y + 2.0f, 0.0f); | ||||
| BLF_draw(fontid, numstr, sizeof(numstr)); | BLF_draw(fontid, numstr, sizeof(numstr)); | ||||
| } | } | ||||
| void ED_region_cache_draw_cached_segments( | void ED_region_cache_draw_cached_segments( | ||||
| const ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra) | ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra) | ||||
| { | { | ||||
| if (num_segments) { | if (num_segments) { | ||||
| /* Local coordinate visible rect inside region, to accommodate overlapping ui. */ | |||||
Done Inline ActionsSame as above. sergey: Same as above. | |||||
| const rcti *rect_visible = ED_region_visible_rect(ar); | |||||
| const int region_bottom = rect_visible->ymin; | |||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| immUniformColor4ub(128, 128, 255, 128); | immUniformColor4ub(128, 128, 255, 128); | ||||
| for (int a = 0; a < num_segments; a++) { | for (int a = 0; a < num_segments; a++) { | ||||
| float x1 = (float)(points[a * 2] - sfra) / (efra - sfra + 1) * ar->winx; | float x1 = (float)(points[a * 2] - sfra) / (efra - sfra + 1) * ar->winx; | ||||
| float x2 = (float)(points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * ar->winx; | float x2 = (float)(points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * ar->winx; | ||||
| immRecti(pos, x1, 0, x2, 8 * UI_DPI_FAC); | immRecti(pos, x1, region_bottom, x2, region_bottom + 8 * UI_DPI_FAC); | ||||
| /* TODO(merwin): use primitive restart to draw multiple rects more efficiently */ | /* TODO(merwin): use primitive restart to draw multiple rects more efficiently */ | ||||
| } | } | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| ▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines | |||||
Same as above.