diff options
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index df3846b7c6b..51c3cff721a 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -133,7 +133,7 @@ typedef struct IconTexture { } IconTexture; /* ******************* STATIC LOCAL VARS ******************* */ -/* static here to cache results of icon directory scan, so it's not +/* static here to cache results of icon directory scan, so it's not * scanning the filesystem each time the menu is drawn */ static struct ListBase iconfilelist = {NULL, NULL}; static IconTexture icongltex = {0, 0, 0, 0.0f, 0.0f}; @@ -170,9 +170,9 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, /* icon buffers can get initialized runtime now, via datatoc */ if (bbuf) { int y, imgsize; - + iimg->rect = MEM_mallocN(size * size * sizeof(unsigned int), "icon_rect"); - + /* Here we store the rect in the icon - same as before */ if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0) memcpy(iimg->rect, bbuf->rect, size * size * sizeof(int)); @@ -191,7 +191,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, new_icon->drawinfo = di; BKE_icon_set(icon_id, new_icon); - + return di; } @@ -255,10 +255,10 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha, * (since we're doing this offscreen, free from any particular space_id) */ struct bThemeState theme_state; - + UI_Theme_Store(&theme_state); UI_SetTheme(SPACE_ACTION, RGN_TYPE_WINDOW); - + /* the "x" and "y" given are the bottom-left coordinates of the icon, * while the draw_keyframe_shape() function needs the midpoint for * the keyframe @@ -353,7 +353,7 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU { \ vicon_colorset_draw(index, x, y, w, h, alpha); \ } - + DEF_VICON_COLORSET_DRAW_NTH(01, 0) DEF_VICON_COLORSET_DRAW_NTH(02, 1) DEF_VICON_COLORSET_DRAW_NTH(03, 2) @@ -437,14 +437,14 @@ static void icon_verify_datatoc(IconImage *iimg) /* if it has own rect, things are all OK */ if (iimg->rect) return; - + if (iimg->datatoc_rect) { ImBuf *bbuf = IMB_ibImageFromMemory(iimg->datatoc_rect, iimg->datatoc_size, IB_rect, NULL, "<matcap icon>"); /* w and h were set on initialize */ if (bbuf->x != iimg->h && bbuf->y != iimg->w) IMB_scaleImBuf(bbuf, iimg->w, iimg->h); - + iimg->rect = bbuf->rect; bbuf->rect = NULL; IMB_freeImBuf(bbuf); @@ -504,7 +504,7 @@ static void init_internal_icons(void) if ((btheme != NULL) && btheme->tui.iconfile[0]) { char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); char iconfilestr[FILE_MAX]; - + if (icondir) { BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile); bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); /* if the image is missing bbuf will just be NULL */ @@ -530,7 +530,7 @@ static void init_internal_icons(void) datatoc_blender_icons32_png_size, IB_rect, NULL, "<blender icons>"); if (b32buf) IMB_premultiply_alpha(b32buf); - + if (b16buf && b32buf) { /* free existing texture if any */ if (icongltex.id) { @@ -548,17 +548,17 @@ static void init_internal_icons(void) if (icongltex.id) { int level = 2; - + icongltex.w = b32buf->x; icongltex.h = b32buf->y; icongltex.invw = 1.0f / b32buf->x; icongltex.invh = 1.0f / b32buf->y; glBindTexture(GL_TEXTURE_2D, icongltex.id); - + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, b32buf->x, b32buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b32buf->rect); glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA8, b16buf->x, b16buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b16buf->rect); - + while (b16buf->x > 1) { ImBuf *nbuf = IMB_onehalf(b16buf); glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, nbuf->x, nbuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nbuf->rect); @@ -566,10 +566,10 @@ static void init_internal_icons(void) IMB_freeImBuf(b16buf); b16buf = nbuf; } - + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - + glBindTexture(GL_TEXTURE_2D, 0); } } @@ -579,7 +579,7 @@ static void init_internal_icons(void) icontype = ICON_TYPE_TEXTURE; else icontype = ICON_TYPE_BUFFER; - + if (b32buf) { for (y = 0; y < ICON_GRID_ROWS; y++) { for (x = 0; x < ICON_GRID_COLS; x++) { @@ -592,13 +592,13 @@ static void init_internal_icons(void) } def_internal_vicon(VICO_SMALL_TRI_RIGHT_VEC, vicon_small_tri_right_draw); - + def_internal_vicon(VICO_KEYTYPE_KEYFRAME_VEC, vicon_keytype_keyframe_draw); def_internal_vicon(VICO_KEYTYPE_BREAKDOWN_VEC, vicon_keytype_breakdown_draw); def_internal_vicon(VICO_KEYTYPE_EXTREME_VEC, vicon_keytype_extreme_draw); def_internal_vicon(VICO_KEYTYPE_JITTER_VEC, vicon_keytype_jitter_draw); def_internal_vicon(VICO_KEYTYPE_MOVING_HOLD_VEC, vicon_keytype_moving_hold_draw); - + def_internal_vicon(VICO_COLORSET_01_VEC, vicon_colorset_draw_01); def_internal_vicon(VICO_COLORSET_02_VEC, vicon_colorset_draw_02); def_internal_vicon(VICO_COLORSET_03_VEC, vicon_colorset_draw_03); @@ -622,7 +622,7 @@ static void init_internal_icons(void) IMB_freeImBuf(b16buf); IMB_freeImBuf(b32buf); - + } #endif /* WITH_HEADLESS */ @@ -638,13 +638,13 @@ static void init_iconfile_list(struct ListBase *list) if (icondir == NULL) return; - + totfile = BLI_filelist_dir_contents(icondir, &dir); for (i = 0; i < totfile; i++) { if ((dir[i].type & S_IFREG)) { const char *filename = dir[i].relname; - + if (BLI_testextensie(filename, ".png")) { /* loading all icons on file start is overkill & slows startup * its possible they change size after blender load anyway. */ @@ -666,7 +666,7 @@ static void init_iconfile_list(struct ListBase *list) else { ifilex = ifiley = 0; } - + /* bad size or failed to load */ if ((ifilex != ICON_IMAGE_W) || (ifiley != ICON_IMAGE_H)) { printf("icon '%s' is wrong size %dx%d\n", iconfilestr, ifilex, ifiley); @@ -676,12 +676,12 @@ static void init_iconfile_list(struct ListBase *list) /* found a potential icon file, so make an entry for it in the cache list */ ifile = MEM_callocN(sizeof(IconFile), "IconFile"); - + BLI_strncpy(ifile->filename, filename, sizeof(ifile->filename)); ifile->index = index; BLI_addtail(list, ifile); - + index++; } } @@ -694,7 +694,7 @@ static void init_iconfile_list(struct ListBase *list) static void free_iconfile_list(struct ListBase *list) { IconFile *ifile = NULL, *next_ifile = NULL; - + for (ifile = list->first; ifile; ifile = next_ifile) { next_ifile = ifile->next; BLI_freelinkN(list, ifile); @@ -707,20 +707,20 @@ int UI_iconfile_get_index(const char *filename) { IconFile *ifile; ListBase *list = &(iconfilelist); - + for (ifile = list->first; ifile; ifile = ifile->next) { if (BLI_path_cmp(filename, ifile->filename) == 0) { return ifile->index; } } - + return 0; } ListBase *UI_iconfile_list(void) { ListBase *list = &(iconfilelist); - + return list; } @@ -811,13 +811,13 @@ int UI_icon_get_width(int icon_id) DrawInfo *di = NULL; icon = BKE_icon_get(icon_id); - + if (icon == NULL) { if (G.debug & G_DEBUG) printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return 0; } - + di = icon_ensure_drawinfo(icon); if (di) { return ICON_DEFAULT_WIDTH; @@ -955,7 +955,7 @@ static void icon_set_image( PreviewImage *UI_icon_to_preview(int icon_id) { Icon *icon = BKE_icon_get(icon_id); - + if (icon) { DrawInfo *di = (DrawInfo *)icon->drawinfo; if (di) { @@ -1225,10 +1225,10 @@ static void icon_draw_size( IconImage *iimg; const float fdraw_size = (float)draw_size; int w, h; - + icon = BKE_icon_get(icon_id); alpha *= btheme->tui.icon_alpha; - + if (icon == NULL) { if (G.debug & G_DEBUG) printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); @@ -1304,7 +1304,7 @@ static void icon_draw_size( if (pi) { /* no create icon on this level in code */ if (!pi->rect[size]) return; /* something has gone wrong! */ - + /* preview images use premul alpha ... */ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -1341,10 +1341,10 @@ static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs) { PreviewImage *pi = BKE_previewimg_id_ensure(id); enum eIconSizes i; - + if (!pi) return; - + for (i = 0; i < NUM_ICON_SIZES; i++) { /* check if rect needs to be created; changed * only set by dynamic icons */ @@ -1435,7 +1435,7 @@ static int ui_id_screen_get_icon(const bContext *C, ID *id) int ui_id_icon_get(const bContext *C, ID *id, const bool big) { int iconid = 0; - + /* icon */ switch (GS(id->name)) { case ID_BR: |