diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-12-11 17:56:04 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-12-11 17:56:04 +0300 |
commit | 4d115f21595d255f2d335d2f307ee822b381ea54 (patch) | |
tree | dbbd84b1539f4b87df608cb3e7c84cfde5fcb3f6 /source/blender/imbuf | |
parent | 54e1d3815762ef964a74f179ef846110673e743f (diff) | |
parent | 66d8bfb85c61aafe3bad2edf0e7b4d9d694ee2e7 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/oiio/openimageio_api.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index f018bfc09d7..34d5cccac84 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -35,6 +35,11 @@ #include "utfconv.h" #endif +// NOTE: Keep first, BLI_path_util conflicts with OIIO's format. +#include <memory> +#include <openimageio_api.h> +#include <OpenImageIO/imageio.h> + extern "C" { #include "MEM_guardedalloc.h" @@ -48,12 +53,10 @@ extern "C" #include "IMB_colormanagement_intern.h" } -#include <openimageio_api.h> -#include <OpenImageIO/imageio.h> - OIIO_NAMESPACE_USING using std::string; +using std::unique_ptr; typedef unsigned char uchar; @@ -197,7 +200,6 @@ int imb_save_photoshop(struct ImBuf *ibuf, const char * /*name*/, int flags) struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspace[IM_MAX_SPACE]) { - ImageInput *in = NULL; struct ImBuf *ibuf = NULL; int width, height, components; bool is_float, is_alpha; @@ -210,7 +212,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE); - in = ImageInput::create(filename); + unique_ptr<ImageInput> in(ImageInput::create(filename)); if (!in) { std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl << OIIO_NAMESPACE::geterror() << std::endl; @@ -223,7 +225,6 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac if (!in->open(filename, spec, config)) { std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl << in->geterror() << std::endl; - delete in; return NULL; } @@ -249,19 +250,17 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac if (!(components >= 1 && components <= 4)) { if (in) { in->close(); - delete in; } return NULL; } if (is_float) - ibuf = imb_oiio_load_image_float(in, width, height, components, flags, is_alpha); + ibuf = imb_oiio_load_image_float(in.get(), width, height, components, flags, is_alpha); else - ibuf = imb_oiio_load_image(in, width, height, components, flags, is_alpha); + ibuf = imb_oiio_load_image(in.get(), width, height, components, flags, is_alpha); if (in) { in->close(); - delete in; } if (!ibuf) |