[Bf-codereview] Fixes for a couple brush icon problems (bug #26590) (issue4356045)
NicholasBishop at gmail.com
NicholasBishop at gmail.com
Sun Apr 3 17:40:49 CEST 2011
Reviewers: bf-codereview_blender.org,
Description:
Here's the original report:
http://projects.blender.org/tracker/?func=detail&aid=26590&group_id=9&atid=498
Seems that when a custom brush icon was set, the preview was being
regenerated over and over, which prevented other preview jobs from
running. Fixed by not calling BKE_icon_changed every time when calling
get_brush_icon().
Additionally, changing the brush icon path from a valid image path to
empty, or to an invalid path, would leave the original image there.
Fixed by the memsetting the preview before returning.
Please review this at http://codereview.appspot.com/4356045/
Affected files:
source/blender/editors/render/render_preview.c
Index: source/blender/editors/render/render_preview.c
===================================================================
--- source/blender/editors/render/render_preview.c (revision 35974)
+++ source/blender/editors/render/render_preview.c (working copy)
@@ -135,14 +135,15 @@
if (path[0])
brush->icon_imbuf= IMB_loadiffname(path, flags);
}
+
+ if (brush->icon_imbuf)
+ BKE_icon_changed(BKE_icon_getid(&brush->id));
}
}
}
if (!(brush->icon_imbuf))
brush->id.icon_id = 0;
- else
- BKE_icon_changed(BKE_icon_getid(&(brush->id)));
return brush->icon_imbuf;
}
@@ -1247,10 +1248,11 @@
br->icon_imbuf= get_brush_icon(br);
+ memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
+
if(!(br->icon_imbuf) || !(br->icon_imbuf->rect))
return;
- memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
icon_copy_rect(br->icon_imbuf, sp->sizex, sp->sizey, sp->pr_rect);
*do_update= 1;
More information about the Bf-codereview
mailing list