Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/util/ed_draw.c
| Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
| static void draw_overshoot_triangle(const uint8_t color[4], | static void draw_overshoot_triangle(const uint8_t color[4], | ||||
| const bool facing_right, | const bool facing_right, | ||||
| const float x, | const float x, | ||||
| const float y) | const float y) | ||||
| { | { | ||||
| const uint shdr_pos_2d = GPU_vertformat_attr_add( | const uint shdr_pos_2d = 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); | ||||
| GPU_polygon_smooth(true); | GPU_polygon_smooth(true); | ||||
| immUniformColor3ubvAlpha(color, 225); | immUniformColor3ubvAlpha(color, 225); | ||||
| const float triangle_side_length = facing_right ? 6 * U.pixelsize : -6 * U.pixelsize; | const float triangle_side_length = facing_right ? 6 * U.pixelsize : -6 * U.pixelsize; | ||||
| const float triangle_offset = facing_right ? 2 * U.pixelsize : -2 * U.pixelsize; | const float triangle_offset = facing_right ? 2 * U.pixelsize : -2 * U.pixelsize; | ||||
| immBegin(GPU_PRIM_TRIS, 3); | immBegin(GPU_PRIM_TRIS, 3); | ||||
| immVertex2f(shdr_pos_2d, x + triangle_offset + triangle_side_length, y); | immVertex2f(shdr_pos_2d, x + triangle_offset + triangle_side_length, y); | ||||
| ▲ Show 20 Lines • Show All 670 Lines • ▼ Show 20 Lines | void ED_region_image_metadata_draw( | ||||
| if (box_y) { | if (box_y) { | ||||
| /* set up rect */ | /* set up rect */ | ||||
| rctf rect; | rctf rect; | ||||
| BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); | BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); | ||||
| /* draw top box */ | /* draw top box */ | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_METADATA_BG); | immUniformThemeColor(TH_METADATA_BG); | ||||
| immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | ||||
| BLF_enable(blf_mono_font, BLF_CLIPPING); | BLF_enable(blf_mono_font, BLF_CLIPPING); | ||||
| UI_FontThemeColor(blf_mono_font, TH_METADATA_TEXT); | UI_FontThemeColor(blf_mono_font, TH_METADATA_TEXT); | ||||
| metadata_draw_imbuf(ibuf, &rect, blf_mono_font, true); | metadata_draw_imbuf(ibuf, &rect, blf_mono_font, true); | ||||
| BLF_disable(blf_mono_font, BLF_CLIPPING); | BLF_disable(blf_mono_font, BLF_CLIPPING); | ||||
| } | } | ||||
| /* *** lower box*** */ | /* *** lower box*** */ | ||||
| box_y = metadata_box_height_get(ibuf, blf_mono_font, false); | box_y = metadata_box_height_get(ibuf, blf_mono_font, false); | ||||
| if (box_y) { | if (box_y) { | ||||
| /* set up box rect */ | /* set up box rect */ | ||||
| rctf rect; | rctf rect; | ||||
| BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); | BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); | ||||
| /* draw top box */ | /* draw top box */ | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_METADATA_BG); | immUniformThemeColor(TH_METADATA_BG); | ||||
| immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | ||||
| BLF_enable(blf_mono_font, BLF_CLIPPING); | BLF_enable(blf_mono_font, BLF_CLIPPING); | ||||
| UI_FontThemeColor(blf_mono_font, TH_METADATA_TEXT); | UI_FontThemeColor(blf_mono_font, TH_METADATA_TEXT); | ||||
| Show All 9 Lines | |||||