diff options
author | Irie Shinsuke <irieshinsuke@yahoo.co.jp> | 2013-10-18 14:43:54 +0400 |
---|---|---|
committer | Irie Shinsuke <irieshinsuke@yahoo.co.jp> | 2013-10-18 14:43:54 +0400 |
commit | 38c16f9bf4b189227c2fa3805e1c570b35291116 (patch) | |
tree | b64af0357ceb685826538485adb3511a204d2dbe /source/blender/imbuf/intern | |
parent | 9afddac7275843280cf820b665fd5a2d22e83958 (diff) |
Add debug prints to the PSD loader in imbuf. The error message can be obtained from OIIO by geterror().
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/oiio/openimageio_api.cpp | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index 838343dce35..1ee4ee00500 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -98,11 +98,17 @@ static ImBuf *imb_oiio_load_image(ImageInput *in, int width, int height, int com try { - in->read_image(TypeDesc::UINT8, - (uchar *)ibuf->rect + (height - 1) * scanlinesize, - AutoStride, - -scanlinesize, - AutoStride); + if (!in->read_image(TypeDesc::UINT8, + (uchar *)ibuf->rect + (height - 1) * scanlinesize, + AutoStride, + -scanlinesize, + AutoStride)) { + std::cerr << __func__ << ": ImageInput::read_image() failed:" << std::endl + << in->geterror() << std::endl; + if (ibuf) IMB_freeImBuf(ibuf); + + return NULL; + } } catch (const std::exception &exc) { @@ -128,11 +134,17 @@ static ImBuf *imb_oiio_load_image_float(ImageInput *in, int width, int height, i try { - in->read_image(TypeDesc::FLOAT, - (uchar *)ibuf->rect_float + (height - 1) * scanlinesize, - AutoStride, - -scanlinesize, - AutoStride); + if (!in->read_image(TypeDesc::FLOAT, + (uchar *)ibuf->rect_float + (height - 1) * scanlinesize, + AutoStride, + -scanlinesize, + AutoStride)) { + std::cerr << __func__ << ": ImageInput::read_image() failed:" << std::endl + << in->geterror() << std::endl; + if (ibuf) IMB_freeImBuf(ibuf); + + return NULL; + } } catch (const std::exception &exc) { @@ -191,12 +203,18 @@ 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); - if (!in) return NULL; + if (!in) { + std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl + << OpenImageIO::geterror() << std::endl; + return NULL; + } ImageSpec spec, config; config.attribute("oiio:UnassociatedAlpha", (int) 1); if (!in->open(filename, spec, config)) { + std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl + << in->geterror() << std::endl; delete in; return NULL; } |