From 18c1f6b4fb9af467a3a0f092ee65022b802027d0 Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Dec 13 2018 16:59:31 +0000 Subject: Updated patch from upstream for OIIO 2.0. --- diff --git a/blender-oiio2.patch b/blender-oiio2.patch index 99b9604..934592e 100644 --- a/blender-oiio2.patch +++ b/blender-oiio2.patch @@ -1,6 +1,8 @@ +diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp +index 54973fd..bee6dd1 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp -@@ -493,7 +493,7 @@ static PyObject *osl_update_node_func(Py +@@ -493,7 +493,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) socket_type = "NodeSocketString"; data_type = BL::NodeSocket::type_STRING; if(param->validdefault) @@ -9,9 +11,11 @@ } else continue; +diff --git a/intern/cycles/graph/node_xml.cpp b/intern/cycles/graph/node_xml.cpp +index d26b3b2..2a24104 100644 --- a/intern/cycles/graph/node_xml.cpp +++ b/intern/cycles/graph/node_xml.cpp -@@ -250,7 +250,7 @@ void xml_read_node(XMLReader& reader, No +@@ -250,7 +250,7 @@ void xml_read_node(XMLReader& reader, Node *node, xml_node xml_node) } } @@ -20,25 +24,38 @@ reader.node_map[node->name] = node; } ---- a/intern/cycles/render/image.h -+++ b/intern/cycles/render/image.h -@@ -23,6 +23,7 @@ - #include "util/util_image.h" - #include "util/util_string.h" - #include "util/util_thread.h" +diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp +index cf402c3..6df6325 100644 +--- a/intern/cycles/render/buffers.cpp ++++ b/intern/cycles/render/buffers.cpp +@@ -27,6 +27,7 @@ + #include "util/util_opengl.h" + #include "util/util_time.h" + #include "util/util_types.h" +#include "util/util_unique_ptr.h" - #include "util/util_vector.h" CCL_NAMESPACE_BEGIN -@@ -133,7 +134,7 @@ private: - bool pack_images; - bool file_load_image_generic(Image *img, -- ImageInput **in, -+ unique_ptr *in, - int &width, - int &height, - int &depth, +@@ -453,7 +454,7 @@ void DisplayBuffer::write(Device *device, const string& filename) + device->pixels_copy_from(rgba, 0, w, h); + + /* write image */ +- ImageOutput *out = ImageOutput::create(filename); ++ unique_ptr out(ImageOutput::create(filename)); + ImageSpec spec(w, h, 4, TypeDesc::UINT8); + int scanlinesize = w*4*sizeof(uchar); + +@@ -467,8 +468,6 @@ void DisplayBuffer::write(Device *device, const string& filename) + AutoStride); + + out->close(); +- +- delete out; + } + + device_memory& DisplayBuffer::rgba_data() +diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp +index 595eb46..e8b679d 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -23,6 +23,7 @@ @@ -49,7 +66,7 @@ #ifdef WITH_OSL #include -@@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_me +@@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_metadata(const string& filename, return IMAGE_DATA_TYPE_BYTE4; } @@ -58,15 +75,16 @@ if(in) { ImageSpec spec; -@@ -194,7 +195,6 @@ ImageDataType ImageManager::get_image_me +@@ -193,8 +194,6 @@ ImageDataType ImageManager::get_image_metadata(const string& filename, + in->close(); } - +- - delete in; } if(is_half) { -@@ -449,7 +449,7 @@ void ImageManager::tag_reload_image(cons +@@ -449,7 +448,7 @@ void ImageManager::tag_reload_image(const string& filename, } bool ImageManager::file_load_image_generic(Image *img, @@ -75,7 +93,7 @@ int &width, int &height, int &depth, -@@ -465,7 +465,7 @@ bool ImageManager::file_load_image_gener +@@ -465,7 +464,7 @@ bool ImageManager::file_load_image_generic(Image *img, } /* load image from file through OIIO */ @@ -84,7 +102,7 @@ if(!*in) return false; -@@ -477,8 +477,6 @@ bool ImageManager::file_load_image_gener +@@ -477,8 +476,6 @@ bool ImageManager::file_load_image_generic(Image *img, config.attribute("oiio:UnassociatedAlpha", 1); if(!(*in)->open(img->filename, spec, config)) { @@ -93,7 +111,7 @@ return false; } -@@ -500,10 +498,7 @@ bool ImageManager::file_load_image_gener +@@ -500,10 +497,7 @@ bool ImageManager::file_load_image_generic(Image *img, if(!(components >= 1 && components <= 4)) { if(*in) { (*in)->close(); @@ -104,7 +122,7 @@ return false; } -@@ -519,7 +514,7 @@ bool ImageManager::file_load_image(Image +@@ -519,7 +513,7 @@ bool ImageManager::file_load_image(Image *img, device_vector& tex_img) { const StorageType alpha_one = (FileFormat == TypeDesc::UINT8)? 255 : 1; @@ -113,7 +131,7 @@ int width, height, depth, components; if(!file_load_image_generic(img, &in, width, height, depth, components)) { return false; -@@ -575,7 +570,6 @@ bool ImageManager::file_load_image(Image +@@ -575,7 +569,6 @@ bool ImageManager::file_load_image(Image *img, } cmyk = strcmp(in->format_name(), "jpeg") == 0 && components == 4; in->close(); @@ -121,6 +139,30 @@ } else { if(FileFormat == TypeDesc::FLOAT) { +diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h +index db7e28a..f4a14f4 100644 +--- a/intern/cycles/render/image.h ++++ b/intern/cycles/render/image.h +@@ -23,6 +23,7 @@ + #include "util/util_image.h" + #include "util/util_string.h" + #include "util/util_thread.h" ++#include "util/util_unique_ptr.h" + #include "util/util_vector.h" + + CCL_NAMESPACE_BEGIN +@@ -133,7 +134,7 @@ private: + bool pack_images; + + bool file_load_image_generic(Image *img, +- ImageInput **in, ++ unique_ptr *in, + int &width, + int &height, + int &depth, +diff --git a/intern/cycles/util/util_unique_ptr.h b/intern/cycles/util/util_unique_ptr.h +new file mode 100644 +index 0000000..1ceae73 --- /dev/null +++ b/intern/cycles/util/util_unique_ptr.h @@ -0,0 +1,28 @@ @@ -152,6 +194,8 @@ +CCL_NAMESPACE_END + +#endif /* __UTIL_UNIQUE_PTR_H__ */ +diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp +index b123d50..7f2fac9 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -35,6 +35,11 @@ @@ -180,7 +224,7 @@ typedef unsigned char uchar; -@@ -197,7 +200,6 @@ int imb_save_photoshop(struct ImBuf *ibu +@@ -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]) { @@ -188,7 +232,7 @@ struct ImBuf *ibuf = NULL; int width, height, components; bool is_float, is_alpha; -@@ -210,7 +212,7 @@ struct ImBuf *imb_load_photoshop(const c +@@ -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); @@ -197,7 +241,7 @@ 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 c +@@ -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; @@ -205,7 +249,7 @@ return NULL; } -@@ -249,19 +250,17 @@ struct ImBuf *imb_load_photoshop(const c +@@ -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(); @@ -226,23 +270,4 @@ - delete in; } - if (!ibuf) ---- a/intern/cycles/render/buffers.cpp -+++ b/intern/cycles/render/buffers.cpp -@@ -453,7 +453,7 @@ void DisplayBuffer::write(Device *device - device->pixels_copy_from(rgba, 0, w, h); - - /* write image */ -- ImageOutput *out = ImageOutput::create(filename); -+ auto out = ImageOutput::create(filename); - ImageSpec spec(w, h, 4, TypeDesc::UINT8); - int scanlinesize = w*4*sizeof(uchar); - -@@ -468,7 +468,6 @@ void DisplayBuffer::write(Device *device - - out->close(); - -- delete out; - } - - device_memory& DisplayBuffer::rgba_data() + if (!ibuf) \ No newline at end of file