Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-01-04 03:53:05 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-04 09:37:44 +0300
commit12409b2069d175fd3ebf578d91d190fe75272c87 (patch)
tree1f91b59f2dfe0f024f895b755113af59dbb91e6a /source/blender/editors/render/render_preview.c
parent01f38c10cb5045de9ca9a4284793966ca5dd5af6 (diff)
Cleanup: rename get_brush_icon, make it a static function
Group with other icon preview API functions.
Diffstat (limited to 'source/blender/editors/render/render_preview.c')
-rw-r--r--source/blender/editors/render/render_preview.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 579fd86077e..793b23fcf32 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -105,52 +105,6 @@
static void icon_copy_rect(ImBuf *ibuf, uint w, uint h, uint *rect);
-ImBuf *get_brush_icon(Brush *brush)
-{
- static const int flags = IB_rect | IB_multilayer | IB_metadata;
-
- char path[FILE_MAX];
- const char *folder;
-
- if (!(brush->icon_imbuf)) {
- if (brush->flag & BRUSH_CUSTOM_ICON) {
-
- if (brush->icon_filepath[0]) {
- /* First use the path directly to try and load the file. */
-
- BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath));
- BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&brush->id));
-
- /* use default colorspaces for brushes */
- brush->icon_imbuf = IMB_loadiffname(path, flags, NULL);
-
- /* otherwise lets try to find it in other directories */
- if (!(brush->icon_imbuf)) {
- folder = BKE_appdir_folder_id(BLENDER_DATAFILES, "brushicons");
-
- BLI_make_file_string(
- BKE_main_blendfile_path_from_global(), path, folder, brush->icon_filepath);
-
- if (path[0]) {
- /* use fefault color spaces */
- brush->icon_imbuf = IMB_loadiffname(path, flags, NULL);
- }
- }
-
- if (brush->icon_imbuf) {
- BKE_icon_changed(BKE_icon_id_ensure(&brush->id));
- }
- }
- }
- }
-
- if (!(brush->icon_imbuf)) {
- brush->id.icon_id = 0;
- }
-
- return brush->icon_imbuf;
-}
-
typedef struct ShaderPreview {
/* from wmJob */
void *owner;
@@ -1147,6 +1101,52 @@ static void shader_preview_free(void *customdata)
/* ************************* icon preview ********************** */
+static ImBuf *icon_preview_imbuf_from_brush(Brush *brush)
+{
+ static const int flags = IB_rect | IB_multilayer | IB_metadata;
+
+ char path[FILE_MAX];
+ const char *folder;
+
+ if (!(brush->icon_imbuf)) {
+ if (brush->flag & BRUSH_CUSTOM_ICON) {
+
+ if (brush->icon_filepath[0]) {
+ /* First use the path directly to try and load the file. */
+
+ BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath));
+ BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&brush->id));
+
+ /* use default colorspaces for brushes */
+ brush->icon_imbuf = IMB_loadiffname(path, flags, NULL);
+
+ /* otherwise lets try to find it in other directories */
+ if (!(brush->icon_imbuf)) {
+ folder = BKE_appdir_folder_id(BLENDER_DATAFILES, "brushicons");
+
+ BLI_make_file_string(
+ BKE_main_blendfile_path_from_global(), path, folder, brush->icon_filepath);
+
+ if (path[0]) {
+ /* use fefault color spaces */
+ brush->icon_imbuf = IMB_loadiffname(path, flags, NULL);
+ }
+ }
+
+ if (brush->icon_imbuf) {
+ BKE_icon_changed(BKE_icon_id_ensure(&brush->id));
+ }
+ }
+ }
+ }
+
+ if (!(brush->icon_imbuf)) {
+ brush->id.icon_id = 0;
+ }
+
+ return brush->icon_imbuf;
+}
+
static void icon_copy_rect(ImBuf *ibuf, uint w, uint h, uint *rect)
{
struct ImBuf *ima;
@@ -1277,7 +1277,7 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
else if (idtype == ID_BR) {
Brush *br = (Brush *)id;
- br->icon_imbuf = get_brush_icon(br);
+ br->icon_imbuf = icon_preview_imbuf_from_brush(br);
memset(sp->pr_rect, 0x88, sp->sizex * sp->sizey * sizeof(uint));