Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / image.c
index d165c6d..fc6530a 100644 (file)
@@ -576,7 +576,7 @@ static void image_init_color_management(Image *ima)
 
 char BKE_image_alpha_mode_from_extension_ex(const char *filepath)
 {
-       if (BLI_testextensie_n(filepath, ".exr", ".cin", ".dpx", ".hdr", NULL)) {
+       if (BLI_path_extension_check_n(filepath, ".exr", ".cin", ".dpx", ".hdr", NULL)) {
                return IMA_ALPHA_PREMUL;
        }
        else {
@@ -607,7 +607,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
        ima = image_alloc(bmain, BLI_path_basename(filepath), IMA_SRC_FILE, IMA_TYPE_IMAGE);
        STRNCPY(ima->name, filepath);
 
-       if (BLI_testextensie_array(filepath, imb_ext_movie))
+       if (BLI_path_extension_check_array(filepath, imb_ext_movie))
                ima->source = IMA_SRC_MOVIE;
 
        image_init_color_management(ima);
@@ -1352,63 +1352,63 @@ static bool do_add_image_extension(char *string, const char imtype, const ImageF
        (void)im_format;  /* may be unused, depends on build options */
 
        if (imtype == R_IMF_IMTYPE_IRIS) {
-               if (!BLI_testextensie(string, extension_test = ".rgb"))
+               if (!BLI_path_extension_check(string, extension_test = ".rgb"))
                        extension = extension_test;
        }
        else if (imtype == R_IMF_IMTYPE_IRIZ) {
-               if (!BLI_testextensie(string, extension_test = ".rgb"))
+               if (!BLI_path_extension_check(string, extension_test = ".rgb"))
                        extension = extension_test;
        }
 #ifdef WITH_HDR
        else if (imtype == R_IMF_IMTYPE_RADHDR) {
-               if (!BLI_testextensie(string, extension_test = ".hdr"))
+               if (!BLI_path_extension_check(string, extension_test = ".hdr"))
                        extension = extension_test;
        }
 #endif
        else if (ELEM(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
-               if (!BLI_testextensie(string, extension_test = ".png"))
+               if (!BLI_path_extension_check(string, extension_test = ".png"))
                        extension = extension_test;
        }
 #ifdef WITH_DDS
        else if (imtype == R_IMF_IMTYPE_DDS) {
-               if (!BLI_testextensie(string, extension_test = ".dds"))
+               if (!BLI_path_extension_check(string, extension_test = ".dds"))
                        extension = extension_test;
        }
 #endif
        else if (ELEM(imtype, R_IMF_IMTYPE_TARGA, R_IMF_IMTYPE_RAWTGA)) {
-               if (!BLI_testextensie(string, extension_test = ".tga"))
+               if (!BLI_path_extension_check(string, extension_test = ".tga"))
                        extension = extension_test;
        }
        else if (imtype == R_IMF_IMTYPE_BMP) {
-               if (!BLI_testextensie(string, extension_test = ".bmp"))
+               if (!BLI_path_extension_check(string, extension_test = ".bmp"))
                        extension = extension_test;
        }
 #ifdef WITH_TIFF
        else if (imtype == R_IMF_IMTYPE_TIFF) {
-               if (!BLI_testextensie_n(string, extension_test = ".tif", ".tiff", NULL)) {
+               if (!BLI_path_extension_check_n(string, extension_test = ".tif", ".tiff", NULL)) {
                        extension = extension_test;
                }
        }
 #endif
 #ifdef WITH_OPENIMAGEIO
        else if (imtype == R_IMF_IMTYPE_PSD) {
-               if (!BLI_testextensie(string, extension_test = ".psd"))
+               if (!BLI_path_extension_check(string, extension_test = ".psd"))
                        extension = extension_test;
        }
 #endif
 #ifdef WITH_OPENEXR
        else if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) {
-               if (!BLI_testextensie(string, extension_test = ".exr"))
+               if (!BLI_path_extension_check(string, extension_test = ".exr"))
                        extension = extension_test;
        }
 #endif
 #ifdef WITH_CINEON
        else if (imtype == R_IMF_IMTYPE_CINEON) {
-               if (!BLI_testextensie(string, extension_test = ".cin"))
+               if (!BLI_path_extension_check(string, extension_test = ".cin"))
                        extension = extension_test;
        }
        else if (imtype == R_IMF_IMTYPE_DPX) {
-               if (!BLI_testextensie(string, extension_test = ".dpx"))
+               if (!BLI_path_extension_check(string, extension_test = ".dpx"))
                        extension = extension_test;
        }
 #endif
@@ -1416,35 +1416,35 @@ static bool do_add_image_extension(char *string, const char imtype, const ImageF
        else if (imtype == R_IMF_IMTYPE_JP2) {
                if (im_format) {
                        if (im_format->jp2_codec == R_IMF_JP2_CODEC_JP2) {
-                               if (!BLI_testextensie(string, extension_test = ".jp2"))
+                               if (!BLI_path_extension_check(string, extension_test = ".jp2"))
                                        extension = extension_test;
                        }
                        else if (im_format->jp2_codec == R_IMF_JP2_CODEC_J2K) {
-                               if (!BLI_testextensie(string, extension_test = ".j2c"))
+                               if (!BLI_path_extension_check(string, extension_test = ".j2c"))
                                        extension = extension_test;
                        }
                        else
                                BLI_assert(!"Unsupported jp2 codec was specified in im_format->jp2_codec");
                }
                else {
-                       if (!BLI_testextensie(string, extension_test = ".jp2"))
+                       if (!BLI_path_extension_check(string, extension_test = ".jp2"))
                                extension = extension_test;
                }
        }
 #endif
        else { //   R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90 etc
-               if (!(BLI_testextensie_n(string, extension_test = ".jpg", ".jpeg", NULL)))
+               if (!(BLI_path_extension_check_n(string, extension_test = ".jpg", ".jpeg", NULL)))
                        extension = extension_test;
        }
 
        if (extension) {
                /* prefer this in many cases to avoid .png.tga, but in certain cases it breaks */
                /* remove any other known image extension */
-               if (BLI_testextensie_array(string, imb_ext_image)) {
-                       return BLI_replace_extension(string, FILE_MAX, extension);
+               if (BLI_path_extension_check_array(string, imb_ext_image)) {
+                       return BLI_path_extension_replace(string, FILE_MAX, extension);
                }
                else {
-                       return BLI_ensure_extension(string, FILE_MAX, extension);
+                       return BLI_path_extension_ensure(string, FILE_MAX, extension);
                }
 
        }
@@ -3028,7 +3028,7 @@ bool BKE_image_is_openexr(struct Image *ima)
 {
 #ifdef WITH_OPENEXR
        if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE)) {
-               return BLI_testextensie(ima->name, ".exr");
+               return BLI_path_extension_check(ima->name, ".exr");
        }
 #else
        UNUSED_VARS(ima);