style chang, made mainly because I wanted to be able to add breakpoints to MEM_freeN...
[blender.git] / source / blender / editors / interface / interface_icons.c
index 39f6cb7b0c265012fe77ef622b6cc2b34a353fb3..3feda5d4db411783aa19c8c723ff1a17bf3362c4 100644 (file)
@@ -462,10 +462,10 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
 static void init_brush_icons(void)
 {
 
-#define INIT_BRUSH_ICON(icon_id, name)                                      \
-       bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_ ##name## _png, \
-                                    datatoc_ ##name## _png_size, IB_rect);  \
-       def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER);         \
+#define INIT_BRUSH_ICON(icon_id, name)                                         \
+       bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_ ##name## _png,       \
+                                        datatoc_ ##name## _png_size, IB_rect, "<brush icon>");    \
+       def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER);               \
        IMB_freeImBuf(bbuf);
        // end INIT_BRUSH_ICON
 
@@ -506,10 +506,10 @@ static void init_brush_icons(void)
 
 static void init_internal_icons(void)
 {
-       bTheme *btheme= U.themes.first;
+       bTheme *btheme= UI_GetTheme();
        ImBuf *bbuf= NULL;
        int x, y, icontype;
-       char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
+       char iconfilestr[FILE_MAX];
        
        if ((btheme!=NULL) && btheme->tui.iconfile[0]) {
                char *icondir= BLI_get_folder(BLENDER_DATAFILES, "icons");
@@ -527,7 +527,7 @@ static void init_internal_icons(void)
                }
        }
        if(bbuf==NULL)
-               bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
+               bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, "<blender icons>");
 
        if(bbuf) {
                /* free existing texture if any */
@@ -665,7 +665,9 @@ static void init_iconfile_list(struct ListBase *list)
        for(; i>=0; i--){
                MEM_freeN(dir[i].relname);
                MEM_freeN(dir[i].path);
-               if (dir[i].string) MEM_freeN(dir[i].string);
+               if (dir[i].string) {
+                       MEM_freeN(dir[i].string);
+               }
        }
        free(dir);
        dir= NULL;
@@ -950,6 +952,7 @@ static int get_draw_size(enum eIconSizes size)
 
 static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
 {
+       bTheme *btheme= UI_GetTheme();
        Icon *icon = NULL;
        DrawInfo *di = NULL;
        IconImage *iimg;
@@ -957,6 +960,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
        int w, h;
        
        icon = BKE_icon_get(icon_id);
+       alpha *= btheme->tui.icon_alpha;
        
        if (icon==NULL) {
                if (G.f & G_DEBUG)