Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/file_draw.c
| Show First 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | if (icon && is_icon) { | ||||
| UI_GetThemeColor4fv(TH_ICON_FOLDER, bgcolor); | UI_GetThemeColor4fv(TH_ICON_FOLDER, bgcolor); | ||||
| if (rgb_to_grayscale(bgcolor) < 0.5f) { | if (rgb_to_grayscale(bgcolor) < 0.5f) { | ||||
| icon_color[0] = 255; | icon_color[0] = 255; | ||||
| icon_color[1] = 255; | icon_color[1] = 255; | ||||
| icon_color[2] = 255; | icon_color[2] = 255; | ||||
| } | } | ||||
| icon_x = xco + (ex / 2.0f) - (icon_size / 2.0f); | icon_x = xco + (ex / 2.0f) - (icon_size / 2.0f); | ||||
| icon_y = yco + (ey / 2.0f) - (icon_size * ((file->typeflag & FILE_TYPE_DIR) ? 0.78f : 0.75f)); | icon_y = yco + (ey / 2.0f) - (icon_size * ((file->typeflag & FILE_TYPE_DIR) ? 0.78f : 0.75f)); | ||||
| UI_icon_draw_ex( | UI_icon_draw_ex(icon_x, | ||||
| icon_x, icon_y, icon, icon_aspect / U.dpi_fac, icon_opacity, 0.0f, icon_color, false); | icon_y, | ||||
| icon, | |||||
| icon_aspect / U.dpi_fac, | |||||
| icon_opacity, | |||||
| 0.0f, | |||||
| icon_color, | |||||
| false, | |||||
| UI_NO_ICON_OVERLAY_TEXT); | |||||
| } | } | ||||
| if (is_link || is_offline) { | if (is_link || is_offline) { | ||||
| /* Icon at bottom to indicate it is a shortcut, link, alias, or offline. */ | /* Icon at bottom to indicate it is a shortcut, link, alias, or offline. */ | ||||
| float icon_x, icon_y; | float icon_x, icon_y; | ||||
| icon_x = xco + (2.0f * UI_DPI_FAC); | icon_x = xco + (2.0f * UI_DPI_FAC); | ||||
| icon_y = yco + (2.0f * UI_DPI_FAC); | icon_y = yco + (2.0f * UI_DPI_FAC); | ||||
| const int arrow = is_link ? ICON_LOOP_FORWARDS : ICON_URL; | const int arrow = is_link ? ICON_LOOP_FORWARDS : ICON_URL; | ||||
| if (!is_icon) { | if (!is_icon) { | ||||
| /* At very bottom-left if preview style. */ | /* At very bottom-left if preview style. */ | ||||
| const uchar dark[4] = {0, 0, 0, 255}; | const uchar dark[4] = {0, 0, 0, 255}; | ||||
| const uchar light[4] = {255, 255, 255, 255}; | const uchar light[4] = {255, 255, 255, 255}; | ||||
| UI_icon_draw_ex(icon_x + 1, icon_y - 1, arrow, 1.0f / U.dpi_fac, 0.2f, 0.0f, dark, false); | UI_icon_draw_ex(icon_x + 1, | ||||
| UI_icon_draw_ex(icon_x, icon_y, arrow, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false); | icon_y - 1, | ||||
| arrow, | |||||
| 1.0f / U.dpi_fac, | |||||
| 0.2f, | |||||
| 0.0f, | |||||
| dark, | |||||
| false, | |||||
| UI_NO_ICON_OVERLAY_TEXT); | |||||
| UI_icon_draw_ex(icon_x, | |||||
| icon_y, | |||||
| arrow, | |||||
| 1.0f / U.dpi_fac, | |||||
| 0.6f, | |||||
| 0.0f, | |||||
| light, | |||||
| false, | |||||
| UI_NO_ICON_OVERLAY_TEXT); | |||||
| } | } | ||||
| else { | else { | ||||
| /* Link to folder or non-previewed file. */ | /* Link to folder or non-previewed file. */ | ||||
| uchar icon_color[4]; | uchar icon_color[4]; | ||||
| UI_GetThemeColor4ubv(TH_BACK, icon_color); | UI_GetThemeColor4ubv(TH_BACK, icon_color); | ||||
| icon_x = xco + ((file->typeflag & FILE_TYPE_DIR) ? 0.14f : 0.23f) * scaledx; | icon_x = xco + ((file->typeflag & FILE_TYPE_DIR) ? 0.14f : 0.23f) * scaledx; | ||||
| icon_y = yco + ((file->typeflag & FILE_TYPE_DIR) ? 0.24f : 0.14f) * scaledy; | icon_y = yco + ((file->typeflag & FILE_TYPE_DIR) ? 0.24f : 0.14f) * scaledy; | ||||
| UI_icon_draw_ex( | UI_icon_draw_ex(icon_x, | ||||
| icon_x, icon_y, arrow, icon_aspect / U.dpi_fac * 1.8, 0.3f, 0.0f, icon_color, false); | icon_y, | ||||
| arrow, | |||||
| icon_aspect / U.dpi_fac * 1.8, | |||||
| 0.3f, | |||||
| 0.0f, | |||||
| icon_color, | |||||
| false, | |||||
| UI_NO_ICON_OVERLAY_TEXT); | |||||
| } | } | ||||
| } | } | ||||
| else if (icon && !is_icon && !(file->typeflag & FILE_TYPE_FTFONT)) { | else if (icon && !is_icon && !(file->typeflag & FILE_TYPE_FTFONT)) { | ||||
| /* Smaller, fainter icon at bottom-left for preview image thumbnail, but not for fonts. */ | /* Smaller, fainter icon at bottom-left for preview image thumbnail, but not for fonts. */ | ||||
| float icon_x, icon_y; | float icon_x, icon_y; | ||||
| const uchar dark[4] = {0, 0, 0, 255}; | const uchar dark[4] = {0, 0, 0, 255}; | ||||
| const uchar light[4] = {255, 255, 255, 255}; | const uchar light[4] = {255, 255, 255, 255}; | ||||
| icon_x = xco + (2.0f * UI_DPI_FAC); | icon_x = xco + (2.0f * UI_DPI_FAC); | ||||
| icon_y = yco + (2.0f * UI_DPI_FAC); | icon_y = yco + (2.0f * UI_DPI_FAC); | ||||
| UI_icon_draw_ex(icon_x + 1, icon_y - 1, icon, 1.0f / U.dpi_fac, 0.2f, 0.0f, dark, false); | UI_icon_draw_ex(icon_x + 1, | ||||
| UI_icon_draw_ex(icon_x, icon_y, icon, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false); | icon_y - 1, | ||||
| icon, | |||||
| 1.0f / U.dpi_fac, | |||||
| 0.2f, | |||||
| 0.0f, | |||||
| dark, | |||||
| false, | |||||
| UI_NO_ICON_OVERLAY_TEXT); | |||||
| UI_icon_draw_ex( | |||||
| icon_x, icon_y, icon, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false, UI_NO_ICON_OVERLAY_TEXT); | |||||
| } | } | ||||
| const bool is_current_main_data = filelist_file_get_id(file) != NULL; | const bool is_current_main_data = filelist_file_get_id(file) != NULL; | ||||
| if (is_current_main_data) { | if (is_current_main_data) { | ||||
| /* Smaller, fainter icon at the top-right indicating that the file represents data from the | /* Smaller, fainter icon at the top-right indicating that the file represents data from the | ||||
| * current file (from current #Main in fact). */ | * current file (from current #Main in fact). */ | ||||
| float icon_x, icon_y; | float icon_x, icon_y; | ||||
| const uchar light[4] = {255, 255, 255, 255}; | const uchar light[4] = {255, 255, 255, 255}; | ||||
| icon_x = xco + ex - UI_UNIT_X; | icon_x = xco + ex - UI_UNIT_X; | ||||
| icon_y = yco + ey - UI_UNIT_Y; | icon_y = yco + ey - UI_UNIT_Y; | ||||
| UI_icon_draw_ex(icon_x, icon_y, ICON_CURRENT_FILE, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false); | UI_icon_draw_ex(icon_x, | ||||
| icon_y, | |||||
| ICON_CURRENT_FILE, | |||||
| 1.0f / U.dpi_fac, | |||||
| 0.6f, | |||||
| 0.0f, | |||||
| light, | |||||
| false, | |||||
| UI_NO_ICON_OVERLAY_TEXT); | |||||
| } | } | ||||
| /* Contrasting outline around some preview types. */ | /* Contrasting outline around some preview types. */ | ||||
| if (show_outline) { | if (show_outline) { | ||||
| 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_3D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| float border_color[4] = {1.0f, 1.0f, 1.0f, 0.4f}; | float border_color[4] = {1.0f, 1.0f, 1.0f, 0.4f}; | ||||
| ▲ Show 20 Lines • Show All 696 Lines • Show Last 20 Lines | |||||