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>2020-11-13 03:24:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-13 03:28:24 +0300
commit454b7876ff18c5103cad7d1ebc4e7bef5b1bff4b (patch)
tree81040e9e44f6fbf50f377e1618caf17088980b5c /source/blender/imbuf/intern/util.c
parentac299bb45328da8dc3586be25bcff78ddfc2e03a (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/util.c')
-rw-r--r--source/blender/imbuf/intern/util.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 5b9aa9ed88a..c18321ae2fe 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -180,14 +180,13 @@ bool IMB_ispic_type_matches(const char *filepath, int filetype)
return false;
}
- for (const ImFileType *type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
- if (type->filetype == filetype) {
- /* Requesting to load a type that can't check it's own header doesn't make sense.
- * Keep the check for developers. */
- BLI_assert(type->is_a != NULL);
- if (type->is_a != NULL) {
- return type->is_a(buf, (size_t)buf_size);
- }
+ const ImFileType *type = IMB_file_type_from_ftype(filetype);
+ if (type != NULL) {
+ /* Requesting to load a type that can't check it's own header doesn't make sense.
+ * Keep the check for developers. */
+ BLI_assert(type->is_a != NULL);
+ if (type->is_a != NULL) {
+ return type->is_a(buf, (size_t)buf_size);
}
}
return false;
@@ -416,11 +415,10 @@ bool IMB_isanim(const char *filepath)
bool IMB_isfloat(const ImBuf *ibuf)
{
- const ImFileType *type;
-
- for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
- if (type->ftype(type, ibuf)) {
- return (type->flag & IM_FTYPE_FLOAT) != 0;
+ const ImFileType *type = IMB_file_type_from_ibuf(ibuf);
+ if (type != NULL) {
+ if (type->flag & IM_FTYPE_FLOAT) {
+ return true;
}
}
return false;