Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_image/image_draw.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if (total_tiles) { | ||||
| UI_view2d_view_to_region(®ion->v2d, 0.0f, 0.0f, &x, &y); | UI_view2d_view_to_region(®ion->v2d, 0.0f, 0.0f, &x, &y); | ||||
| GPU_matrix_push(); | GPU_matrix_push(); | ||||
| GPU_matrix_translate_2f(x, y); | GPU_matrix_translate_2f(x, y); | ||||
| GPU_matrix_scale_2f(zoomx, zoomy); | GPU_matrix_scale_2f(zoomx, zoomy); | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = 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); | ||||
| immUniformThemeColor(TH_FACE_SELECT); | immUniformThemeColor(TH_FACE_SELECT); | ||||
| GPU_line_width(1.0f); | GPU_line_width(1.0f); | ||||
| rcti *tile = tiles; | rcti *tile = tiles; | ||||
| for (int i = 0; i < total_tiles; i++, tile++) { | for (int i = 0; i < total_tiles; i++, tile++) { | ||||
| immDrawBorderCorners(pos, tile, zoomx, zoomy); | immDrawBorderCorners(pos, tile, zoomx, zoomy); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0; | float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0; | ||||
| float col[4], finalcol[4]; | float col[4], finalcol[4]; | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| 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_3D_UNIFORM_COLOR); | ||||
| /* noisy, high contrast make impossible to read if lower alpha is used. */ | /* noisy, high contrast make impossible to read if lower alpha is used. */ | ||||
| immUniformColor4ub(0, 0, 0, 190); | immUniformColor4ub(0, 0, 0, 190); | ||||
| immRecti(pos, 0, ymin, BLI_rcti_size_x(®ion->winrct) + 1, ymin + UI_UNIT_Y); | immRecti(pos, 0, ymin, BLI_rcti_size_x(®ion->winrct) + 1, ymin + UI_UNIT_Y); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| ▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | #endif | ||||
| BLI_rcti_init(&color_rect, | BLI_rcti_init(&color_rect, | ||||
| dx, | dx, | ||||
| dx + (1.5f * UI_UNIT_X), | dx + (1.5f * UI_UNIT_X), | ||||
| ymin + 0.15f * UI_UNIT_Y, | ymin + 0.15f * UI_UNIT_Y, | ||||
| ymin + 0.85f * UI_UNIT_Y); | ymin + 0.85f * UI_UNIT_Y); | ||||
| /* BLF uses immediate mode too, so we must reset our vertex format */ | /* BLF uses immediate mode too, so we must reset our vertex format */ | ||||
| pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| if (channels == 4) { | if (channels == 4) { | ||||
| rcti color_rect_half; | rcti color_rect_half; | ||||
| int color_quater_x, color_quater_y; | int color_quater_x, color_quater_y; | ||||
| color_rect_half = color_rect; | color_rect_half = color_rect; | ||||
| color_rect_half.xmax = BLI_rcti_cent_x(&color_rect); | color_rect_half.xmax = BLI_rcti_cent_x(&color_rect); | ||||
| /* what color ??? */ | /* what color ??? */ | ||||
| Show All 26 Lines | #endif | ||||
| else { | else { | ||||
| immUniformColor3fv(finalcol); | immUniformColor3fv(finalcol); | ||||
| immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); | immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); | ||||
| } | } | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| /* draw outline */ | /* draw outline */ | ||||
| pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | 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); | ||||
| immUniformColor3ub(128, 128, 128); | immUniformColor3ub(128, 128, 128); | ||||
| imm_draw_box_wire_2d(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); | imm_draw_box_wire_2d(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| dx += 1.75f * UI_UNIT_X; | dx += 1.75f * UI_UNIT_X; | ||||
| BLF_color3ub(blf_mono_font, 255, 255, 255); | BLF_color3ub(blf_mono_font, 255, 255, 255); | ||||
| if (channels == 1) { | if (channels == 1) { | ||||
| ▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | void draw_image_cache(const bContext *C, ARegion *region) | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| /* Draw current frame. */ | /* Draw current frame. */ | ||||
| x = (cfra - sfra) / (efra - sfra + 1) * region->winx; | x = (cfra - sfra) / (efra - sfra + 1) * region->winx; | ||||
| 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_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_CFRAME); | immUniformThemeColor(TH_CFRAME); | ||||
| immRecti(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_DPI_FAC); | immRecti(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_DPI_FAC); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| ED_region_cache_draw_curfra_label(cfra, x, region_bottom + 8.0f * UI_DPI_FAC); | ED_region_cache_draw_curfra_label(cfra, x, region_bottom + 8.0f * UI_DPI_FAC); | ||||
| if (mask != NULL) { | if (mask != NULL) { | ||||
| ED_mask_draw_frames(mask, region, cfra, sfra, efra); | ED_mask_draw_frames(mask, region, cfra, sfra, efra); | ||||
| ▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines | |||||