]> git.pld-linux.org Git - packages/blender.git/blame - oiio2.patch
- release 4 (by relup.sh)
[packages/blender.git] / oiio2.patch
CommitLineData
3adce530
JR
1--- a/intern/cycles/blender/blender_python.cpp
2+++ b/intern/cycles/blender/blender_python.cpp
3@@ -493,7 +493,7 @@ static PyObject *osl_update_node_func(Py
4 socket_type = "NodeSocketString";
5 data_type = BL::NodeSocket::type_STRING;
6 if(param->validdefault)
7- default_string = param->sdefault[0];
8+ default_string = param->sdefault[0].string();
9 }
10 else
11 continue;
12--- a/intern/cycles/graph/node_xml.cpp
13+++ b/intern/cycles/graph/node_xml.cpp
14@@ -250,7 +250,7 @@ void xml_read_node(XMLReader& reader, No
15 }
16 }
17
18- if(node->name)
19+ if(!node->name.empty())
20 reader.node_map[node->name] = node;
21 }
22
23--- a/intern/cycles/render/buffers.cpp
24+++ b/intern/cycles/render/buffers.cpp
25@@ -27,6 +27,7 @@
26 #include "util/util_opengl.h"
27 #include "util/util_time.h"
28 #include "util/util_types.h"
29+#include "util/util_unique_ptr.h"
30
31 CCL_NAMESPACE_BEGIN
32
33@@ -453,7 +454,7 @@ void DisplayBuffer::write(Device *device
34 device->pixels_copy_from(rgba, 0, w, h);
35
36 /* write image */
37- ImageOutput *out = ImageOutput::create(filename);
38+ unique_ptr<ImageOutput> out(ImageOutput::create(filename));
39 ImageSpec spec(w, h, 4, TypeDesc::UINT8);
40 int scanlinesize = w*4*sizeof(uchar);
41
42@@ -467,8 +468,6 @@ void DisplayBuffer::write(Device *device
43 AutoStride);
44
45 out->close();
46-
47- delete out;
48 }
49
50 device_memory& DisplayBuffer::rgba_data()
51--- a/intern/cycles/render/image.cpp
52+++ b/intern/cycles/render/image.cpp
53@@ -23,6 +23,7 @@
54 #include "util/util_path.h"
55 #include "util/util_progress.h"
56 #include "util/util_texture.h"
57+#include "util/util_unique_ptr.h"
58
59 #ifdef WITH_OSL
60 #include <OSL/oslexec.h>
61@@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_me
62 return IMAGE_DATA_TYPE_BYTE4;
63 }
64
65- ImageInput *in = ImageInput::create(filename);
66+ unique_ptr<ImageInput> in(ImageInput::create(filename));
67
68 if(in) {
69 ImageSpec spec;
70@@ -193,8 +194,6 @@ ImageDataType ImageManager::get_image_me
71
72 in->close();
73 }
74-
75- delete in;
76 }
77
78 if(is_half) {
79@@ -449,7 +448,7 @@ void ImageManager::tag_reload_image(cons
80 }
81
82 bool ImageManager::file_load_image_generic(Image *img,
83- ImageInput **in,
84+ unique_ptr<ImageInput> *in,
85 int &width,
86 int &height,
87 int &depth,
88@@ -465,7 +464,7 @@ bool ImageManager::file_load_image_gener
89 }
90
91 /* load image from file through OIIO */
92- *in = ImageInput::create(img->filename);
93+ *in = unique_ptr<ImageInput>(ImageInput::create(img->filename));
94
95 if(!*in)
96 return false;
97@@ -477,8 +476,6 @@ bool ImageManager::file_load_image_gener
98 config.attribute("oiio:UnassociatedAlpha", 1);
99
100 if(!(*in)->open(img->filename, spec, config)) {
101- delete *in;
102- *in = NULL;
103 return false;
104 }
105
106@@ -500,10 +497,7 @@ bool ImageManager::file_load_image_gener
107 if(!(components >= 1 && components <= 4)) {
108 if(*in) {
109 (*in)->close();
110- delete *in;
111- *in = NULL;
112 }
113-
114 return false;
115 }
116
117@@ -519,7 +513,7 @@ bool ImageManager::file_load_image(Image
118 device_vector<DeviceType>& tex_img)
119 {
120 const StorageType alpha_one = (FileFormat == TypeDesc::UINT8)? 255 : 1;
121- ImageInput *in = NULL;
122+ unique_ptr<ImageInput> in = NULL;
123 int width, height, depth, components;
124 if(!file_load_image_generic(img, &in, width, height, depth, components)) {
125 return false;
126@@ -575,7 +569,6 @@ bool ImageManager::file_load_image(Image
127 }
128 cmyk = strcmp(in->format_name(), "jpeg") == 0 && components == 4;
129 in->close();
130- delete in;
131 }
132 else {
133 if(FileFormat == TypeDesc::FLOAT) {
134--- a/intern/cycles/render/image.h
135+++ b/intern/cycles/render/image.h
136@@ -23,6 +23,7 @@
137 #include "util/util_image.h"
138 #include "util/util_string.h"
139 #include "util/util_thread.h"
140+#include "util/util_unique_ptr.h"
141 #include "util/util_vector.h"
142
143 CCL_NAMESPACE_BEGIN
144@@ -133,7 +134,7 @@ private:
145 bool pack_images;
146
147 bool file_load_image_generic(Image *img,
148- ImageInput **in,
149+ unique_ptr<ImageInput> *in,
150 int &width,
151 int &height,
152 int &depth,
153--- /dev/null
154+++ b/intern/cycles/util/util_unique_ptr.h
155@@ -0,0 +1,28 @@
156+/*
157+ * Copyright 2011-2013 Blender Foundation
158+ *
159+ * Licensed under the Apache License, Version 2.0 (the "License");
160+ * you may not use this file except in compliance with the License.
161+ * You may obtain a copy of the License at
162+ *
163+ * http://www.apache.org/licenses/LICENSE-2.0
164+ *
165+ * Unless required by applicable law or agreed to in writing, software
166+ * distributed under the License is distributed on an "AS IS" BASIS,
167+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
168+ * See the License for the specific language governing permissions and
169+ * limitations under the License.
170+ */
171+
172+#ifndef __UTIL_UNIQUE_PTR_H__
173+#define __UTIL_UNIQUE_PTR_H__
174+
175+#include <memory>
176+
177+CCL_NAMESPACE_BEGIN
178+
179+using std::unique_ptr;
180+
181+CCL_NAMESPACE_END
182+
183+#endif /* __UTIL_UNIQUE_PTR_H__ */
184--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
185+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
186@@ -35,6 +35,11 @@
187 #include "utfconv.h"
188 #endif
189
190+// NOTE: Keep first, BLI_path_util conflicts with OIIO's format.
191+#include <memory>
192+#include <openimageio_api.h>
193+#include <OpenImageIO/imageio.h>
194+
195 extern "C"
196 {
197 #include "MEM_guardedalloc.h"
198@@ -48,12 +53,10 @@ extern "C"
199 #include "IMB_colormanagement_intern.h"
200 }
201
202-#include <openimageio_api.h>
203-#include <OpenImageIO/imageio.h>
204-
205 OIIO_NAMESPACE_USING
206
207 using std::string;
208+using std::unique_ptr;
209
210 typedef unsigned char uchar;
211
212@@ -197,7 +200,6 @@ int imb_save_photoshop(struct ImBuf *ibu
213
214 struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspace[IM_MAX_SPACE])
215 {
216- ImageInput *in = NULL;
217 struct ImBuf *ibuf = NULL;
218 int width, height, components;
219 bool is_float, is_alpha;
220@@ -210,7 +212,7 @@ struct ImBuf *imb_load_photoshop(const c
221
222 colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
223
224- in = ImageInput::create(filename);
225+ unique_ptr<ImageInput> in(ImageInput::create(filename));
226 if (!in) {
227 std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl
228 << OIIO_NAMESPACE::geterror() << std::endl;
229@@ -223,7 +225,6 @@ struct ImBuf *imb_load_photoshop(const c
230 if (!in->open(filename, spec, config)) {
231 std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl
232 << in->geterror() << std::endl;
233- delete in;
234 return NULL;
235 }
236
237@@ -249,19 +250,17 @@ struct ImBuf *imb_load_photoshop(const c
238 if (!(components >= 1 && components <= 4)) {
239 if (in) {
240 in->close();
241- delete in;
242 }
243 return NULL;
244 }
245
246 if (is_float)
247- ibuf = imb_oiio_load_image_float(in, width, height, components, flags, is_alpha);
248+ ibuf = imb_oiio_load_image_float(in.get(), width, height, components, flags, is_alpha);
249 else
250- ibuf = imb_oiio_load_image(in, width, height, components, flags, is_alpha);
251+ ibuf = imb_oiio_load_image(in.get(), width, height, components, flags, is_alpha);
252
253 if (in) {
254 in->close();
255- delete in;
256 }
257
258 if (!ibuf)
This page took 0.055254 seconds and 4 git commands to generate.