diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-13 03:24:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-13 03:28:24 +0300 |
commit | 454b7876ff18c5103cad7d1ebc4e7bef5b1bff4b (patch) | |
tree | 81040e9e44f6fbf50f377e1618caf17088980b5c /source/blender/imbuf/intern/colormanagement.c | |
parent | ac299bb45328da8dc3586be25bcff78ddfc2e03a (diff) |
Cleanup: remove unnecessary ImFileType.ftype callback
This callback made some sense before moving the file-type information
from a bit-flag to an enum: e142ae77cadf04103fbc643f21cf60891862f6a8
Since then, we can compare the type value directly.
Also replace loops over file types with IMB_file_type_from_{ibuf/ftype}.
Diffstat (limited to 'source/blender/imbuf/intern/colormanagement.c')
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index c169633fa3c..9dced926dcc 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -2616,7 +2616,6 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, if (do_colormanagement) { bool make_byte = false; - const ImFileType *type; /* for proper check whether byte buffer is required by a format or not * should be pretty safe since this image buffer is supposed to be used for @@ -2629,13 +2628,10 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, * we need to allocate byte buffer and store color managed * image there */ - for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) { - if (type->save && type->ftype(type, colormanaged_ibuf)) { - if ((type->flag & IM_FTYPE_FLOAT) == 0) { - make_byte = true; - } - - break; + const ImFileType *type = IMB_file_type_from_ibuf(colormanaged_ibuf); + if (type != NULL) { + if ((type->save != NULL) && (type->flag & IM_FTYPE_FLOAT) == 0) { + make_byte = true; } } @@ -3238,14 +3234,11 @@ void IMB_colormanagement_colorspace_from_ibuf_ftype( } /* Get color space from file type. */ - const ImFileType *type; - - for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) { - if (type->save && type->ftype(type, ibuf)) { - const char *role_colorspace; - - role_colorspace = IMB_colormanagement_role_colorspace_name_get(type->default_save_role); - + const ImFileType *type = IMB_file_type_from_ibuf(ibuf); + if (type != NULL) { + if (type->save != NULL) { + const char *role_colorspace = IMB_colormanagement_role_colorspace_name_get( + type->default_save_role); BLI_strncpy(colorspace_settings->name, role_colorspace, sizeof(colorspace_settings->name)); } } |