mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
blender: apply oiio 2.0 patch from upstream.
This commit is contained in:
@@ -15,7 +15,6 @@ SOURCE_URI="https://download.blender.org/source/blender-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="4c944c304a49e68ac687ea06f5758204def049b66dc211e1cffa1857716393bc"
|
||||
PATCHES="
|
||||
blender-$portVersion.patchset
|
||||
blender-$portVersion-gcc-8.patch
|
||||
"
|
||||
ADDITIONAL_FILES="
|
||||
blender.rdef.in
|
||||
@@ -25,7 +24,7 @@ ADDITIONAL_FILES="
|
||||
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
|
||||
SECONDARY_ARCHITECTURES="?x86"
|
||||
|
||||
PYTHON_VERSION="3.6"
|
||||
PYTHON_VERSION="3.7"
|
||||
|
||||
PROVIDES="
|
||||
blender$secondaryArchSuffix = $portVersion
|
||||
@@ -58,15 +57,15 @@ REQUIRES="
|
||||
lib:libglu$secondaryArchSuffix
|
||||
lib:libgomp$secondaryArchSuffix
|
||||
# lib:libgtest$secondaryArchSuffix
|
||||
lib:libhalf$secondaryArchSuffix
|
||||
lib:libhalf_2_4$secondaryArchSuffix
|
||||
lib:libhdf5$secondaryArchSuffix
|
||||
lib:libiconv$secondaryArchSuffix
|
||||
lib:libiex_2_2$secondaryArchSuffix
|
||||
lib:libilmimf_2_2$secondaryArchSuffix
|
||||
lib:libilmthread_2_2$secondaryArchSuffix
|
||||
lib:libimath_2_2$secondaryArchSuffix
|
||||
lib:libiex_2_4$secondaryArchSuffix
|
||||
lib:libilmimf_2_4$secondaryArchSuffix
|
||||
lib:libilmthread_2_4$secondaryArchSuffix
|
||||
lib:libimath_2_4$secondaryArchSuffix
|
||||
lib:libjpeg$secondaryArchSuffix
|
||||
lib:libLLVM_8$secondaryArchSuffix
|
||||
lib:libLLVM_9$secondaryArchSuffix
|
||||
lib:liblzma$secondaryArchSuffix
|
||||
lib:liblzo2$secondaryArchSuffix
|
||||
lib:libopenal$secondaryArchSuffix
|
||||
@@ -94,7 +93,6 @@ REQUIRES="
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
llvm8$secondaryArchSuffix
|
||||
devel:eigen$secondaryArchSuffix
|
||||
devel:libalembic$secondaryArchSuffix
|
||||
devel:libavcodec$secondaryArchSuffix
|
||||
@@ -117,14 +115,15 @@ BUILD_REQUIRES="
|
||||
devel:libglu$secondaryArchSuffix
|
||||
devel:libgomp$secondaryArchSuffix
|
||||
# devel:libgtest$secondaryArchSuffix
|
||||
devel:libhalf$secondaryArchSuffix
|
||||
devel:libhalf_2_4$secondaryArchSuffix
|
||||
devel:libhdf5$secondaryArchSuffix
|
||||
devel:libiconv$secondaryArchSuffix
|
||||
devel:libiex_2_2$secondaryArchSuffix
|
||||
devel:libilmimf_2_2$secondaryArchSuffix
|
||||
devel:libilmthread_2_2$secondaryArchSuffix
|
||||
devel:libimath_2_2$secondaryArchSuffix
|
||||
devel:libiex_2_4$secondaryArchSuffix
|
||||
devel:libilmimf_2_4$secondaryArchSuffix
|
||||
devel:libilmthread_2_4$secondaryArchSuffix
|
||||
devel:libimath_2_4$secondaryArchSuffix
|
||||
devel:libjpeg$secondaryArchSuffix
|
||||
devel:libLLVM_9.0.0$secondaryArchSuffix
|
||||
devel:liblzma$secondaryArchSuffix
|
||||
devel:liblzo2$secondaryArchSuffix
|
||||
devel:libopenal$secondaryArchSuffix
|
||||
@@ -151,13 +150,11 @@ BUILD_REQUIRES="
|
||||
lib:libavdevice$secondaryArchSuffix # REQUIRED
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
llvm8$secondaryArchSuffix
|
||||
numpy_python3
|
||||
requests_python3
|
||||
cmd:cmake
|
||||
cmd:find
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:git
|
||||
cmd:ld$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:python${PYTHON_VERSION}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--- blender-2.79b-orig/intern/cycles/util/util_sseb.h 2018-03-24 02:22:25.000000000 +1100
|
||||
+++ blender-2.79b/intern/cycles/util/util_sseb.h 2018-05-30 20:43:33.888717930 +1000
|
||||
@@ -116,7 +116,7 @@
|
||||
__forceinline const sseb unpackhi( const sseb& a, const sseb& b ) { return _mm_unpackhi_ps(a, b); }
|
||||
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const sseb shuffle( const sseb& a ) {
|
||||
- return _mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
+ return _mm_castsi128_ps(_mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0)));
|
||||
}
|
||||
|
||||
template<> __forceinline const sseb shuffle<0, 1, 0, 1>( const sseb& a ) {
|
||||
--- blender-2.79b-orig/intern/itasc/kdl/tree.hpp 2018-03-24 02:22:25.000000000 +1100
|
||||
+++ blender-2.79b/intern/itasc/kdl/tree.hpp 2018-05-30 20:33:52.045179988 +1000
|
||||
@@ -34,7 +34,7 @@
|
||||
//Forward declaration
|
||||
class TreeElement;
|
||||
// Eigen allocator is needed for alignment of Eigen data types
|
||||
- typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
|
||||
+ typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<const std::string, TreeElement> > > SegmentMap;
|
||||
|
||||
class TreeElement
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
From ec28d64900aebb44e960a910cf6e9493e6fe34f8 Mon Sep 17 00:00:00 2001
|
||||
From 8b0390f920d255529bbcda80f0a0e4712d0475a2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Tue, 19 Sep 2017 23:03:48 +0200
|
||||
Subject: Haiku patchset
|
||||
@@ -151,10 +151,10 @@ index b819c51..9fb3fbf 100644
|
||||
# include <sys/statvfs.h>
|
||||
# define USE_STATFS_STATVFS
|
||||
--
|
||||
2.23.0
|
||||
2.21.0
|
||||
|
||||
|
||||
From 9f274c91374ecd01456f441a2e76a89edc221894 Mon Sep 17 00:00:00 2001
|
||||
From 261a813d36eb18dcd15499882ea0e6b4e92d4dcf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Tue, 19 Sep 2017 23:15:20 +0200
|
||||
Subject: Haiku SDL2 check fix
|
||||
@@ -174,10 +174,10 @@ index 2a835cf..61b7dee 100644
|
||||
|
||||
FIND_LIBRARY(SDL2_LIBRARY
|
||||
--
|
||||
2.23.0
|
||||
2.21.0
|
||||
|
||||
|
||||
From 0430bba05bd566a1ec3c2df6477d94a67581264d Mon Sep 17 00:00:00 2001
|
||||
From bec15f560b9c6ba34e8b6c524d09a36002731212 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Tue, 19 Sep 2017 23:52:27 +0200
|
||||
Subject: In-tree glog supporting patches
|
||||
@@ -373,10 +373,10 @@ index 0000000..4e6703b
|
||||
+# define NO_FRAME_POINTER
|
||||
+#endif
|
||||
--
|
||||
2.23.0
|
||||
2.21.0
|
||||
|
||||
|
||||
From b51551c8c1e8e487e5f219e27d2c227387a4a362 Mon Sep 17 00:00:00 2001
|
||||
From 802a232a87f6e571165e0f8cd90ebf20d15df6b7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Sat, 16 Dec 2017 17:04:56 +0100
|
||||
Subject: OpenCollada support
|
||||
@@ -403,10 +403,10 @@ index 63bc520..28cf0b9 100644
|
||||
${_opencollada_SEARCH_DIRS}
|
||||
)
|
||||
--
|
||||
2.23.0
|
||||
2.21.0
|
||||
|
||||
|
||||
From a3b457c6aa907ce2a77c46208d042129305e4f7b Mon Sep 17 00:00:00 2001
|
||||
From b057f86bd56301ef97138119a5b20e9db746863e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Sat, 4 Aug 2018 12:42:53 +0200
|
||||
Subject: FFMPEG4 patches
|
||||
@@ -526,10 +526,10 @@ index e1b3abc..1850ffd 100644
|
||||
|
||||
if (avio_open(&rv->of->pb, fname, AVIO_FLAG_WRITE) < 0) {
|
||||
--
|
||||
2.23.0
|
||||
2.21.0
|
||||
|
||||
|
||||
From f77901394473f2c325d4bbf8f5175989f8268cd9 Mon Sep 17 00:00:00 2001
|
||||
From 70f94f34c7ad4d6d466213bd4874fff681cc2f1c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
||||
Date: Thu, 22 Aug 2019 18:07:13 +0200
|
||||
Subject: Build fixes from FreeBSD
|
||||
@@ -565,5 +565,331 @@ index 62f76db..1f3b64f 100644
|
||||
|
||||
bool writeMaterial(const COLLADAFW::Material*);
|
||||
--
|
||||
2.23.0
|
||||
2.21.0
|
||||
|
||||
|
||||
From 3f56877f3e1cf268dfd0d7b3313dd239a8bf1188 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Thu, 7 Nov 2019 18:35:57 +0100
|
||||
Subject: applying patch blender-2.79b-gcc-8.patch
|
||||
|
||||
|
||||
diff --git a/intern/cycles/util/util_sseb.h b/intern/cycles/util/util_sseb.h
|
||||
index 6e66970..9ffe391 100644
|
||||
--- a/intern/cycles/util/util_sseb.h
|
||||
+++ b/intern/cycles/util/util_sseb.h
|
||||
@@ -116,7 +116,7 @@ __forceinline const sseb unpacklo( const sseb& a, const sseb& b ) { return _mm_u
|
||||
__forceinline const sseb unpackhi( const sseb& a, const sseb& b ) { return _mm_unpackhi_ps(a, b); }
|
||||
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const sseb shuffle( const sseb& a ) {
|
||||
- return _mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
+ return _mm_castsi128_ps(_mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0)));
|
||||
}
|
||||
|
||||
template<> __forceinline const sseb shuffle<0, 1, 0, 1>( const sseb& a ) {
|
||||
diff --git a/intern/itasc/kdl/tree.hpp b/intern/itasc/kdl/tree.hpp
|
||||
index c8a253f..bd35f82 100644
|
||||
--- a/intern/itasc/kdl/tree.hpp
|
||||
+++ b/intern/itasc/kdl/tree.hpp
|
||||
@@ -34,7 +34,7 @@ namespace KDL
|
||||
//Forward declaration
|
||||
class TreeElement;
|
||||
// Eigen allocator is needed for alignment of Eigen data types
|
||||
- typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
|
||||
+ typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<const std::string, TreeElement> > > SegmentMap;
|
||||
|
||||
class TreeElement
|
||||
{
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
From db0d73ece1ca34119b8f706c4d745c40549a4397 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Sharybin <sergey.vfx@gmail.com>
|
||||
Date: Tue, 11 Dec 2018 12:17:26 +0100
|
||||
Subject: Update code to be compatible with OIIO 2.0
|
||||
|
||||
There are some changes in API of OpenImageIO, but those are quite
|
||||
simple to keep working with older and newer library versions.
|
||||
|
||||
Reviewers: brecht
|
||||
|
||||
Reviewed By: brecht
|
||||
|
||||
Differential Revision: https://developer.blender.org/D4064
|
||||
|
||||
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(PyObject * /*self*/, PyObject *args)
|
||||
socket_type = "NodeSocketString";
|
||||
data_type = BL::NodeSocket::type_STRING;
|
||||
if(param->validdefault)
|
||||
- default_string = param->sdefault[0];
|
||||
+ default_string = param->sdefault[0].string();
|
||||
}
|
||||
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, Node *node, xml_node xml_node)
|
||||
}
|
||||
}
|
||||
|
||||
- if(node->name)
|
||||
+ if(!node->name.empty())
|
||||
reader.node_map[node->name] = node;
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
@@ -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<ImageOutput> 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..7829df9 100644
|
||||
--- a/intern/cycles/render/image.cpp
|
||||
+++ b/intern/cycles/render/image.cpp
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "util/util_path.h"
|
||||
#include "util/util_progress.h"
|
||||
#include "util/util_texture.h"
|
||||
+#include "util/util_unique_ptr.h"
|
||||
|
||||
#ifdef WITH_OSL
|
||||
#include <OSL/oslexec.h>
|
||||
@@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_metadata(const string& filename,
|
||||
return IMAGE_DATA_TYPE_BYTE4;
|
||||
}
|
||||
|
||||
- ImageInput *in = ImageInput::create(filename);
|
||||
+ unique_ptr<ImageInput> in(ImageInput::create(filename));
|
||||
|
||||
if(in) {
|
||||
ImageSpec spec;
|
||||
@@ -194,7 +195,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(const string& filename,
|
||||
}
|
||||
|
||||
bool ImageManager::file_load_image_generic(Image *img,
|
||||
- ImageInput **in,
|
||||
+ unique_ptr<ImageInput> *in,
|
||||
int &width,
|
||||
int &height,
|
||||
int &depth,
|
||||
@@ -465,7 +465,7 @@ bool ImageManager::file_load_image_generic(Image *img,
|
||||
}
|
||||
|
||||
/* load image from file through OIIO */
|
||||
- *in = ImageInput::create(img->filename);
|
||||
+ *in = unique_ptr<ImageInput>(ImageInput::create(img->filename));
|
||||
|
||||
if(!*in)
|
||||
return false;
|
||||
@@ -477,8 +477,6 @@ bool ImageManager::file_load_image_generic(Image *img,
|
||||
config.attribute("oiio:UnassociatedAlpha", 1);
|
||||
|
||||
if(!(*in)->open(img->filename, spec, config)) {
|
||||
- delete *in;
|
||||
- *in = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -500,10 +498,7 @@ bool ImageManager::file_load_image_generic(Image *img,
|
||||
if(!(components >= 1 && components <= 4)) {
|
||||
if(*in) {
|
||||
(*in)->close();
|
||||
- delete *in;
|
||||
- *in = NULL;
|
||||
}
|
||||
-
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -519,7 +514,7 @@ bool ImageManager::file_load_image(Image *img,
|
||||
device_vector<DeviceType>& tex_img)
|
||||
{
|
||||
const StorageType alpha_one = (FileFormat == TypeDesc::UINT8)? 255 : 1;
|
||||
- ImageInput *in = NULL;
|
||||
+ unique_ptr<ImageInput> in = NULL;
|
||||
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 *img,
|
||||
}
|
||||
cmyk = strcmp(in->format_name(), "jpeg") == 0 && components == 4;
|
||||
in->close();
|
||||
- delete in;
|
||||
}
|
||||
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<ImageInput> *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 @@
|
||||
+/*
|
||||
+ * Copyright 2011-2013 Blender Foundation
|
||||
+ *
|
||||
+ * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
+ * you may not use this file except in compliance with the License.
|
||||
+ * You may obtain a copy of the License at
|
||||
+ *
|
||||
+ * http://www.apache.org/licenses/LICENSE-2.0
|
||||
+ *
|
||||
+ * Unless required by applicable law or agreed to in writing, software
|
||||
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
+ * See the License for the specific language governing permissions and
|
||||
+ * limitations under the License.
|
||||
+ */
|
||||
+
|
||||
+#ifndef __UTIL_UNIQUE_PTR_H__
|
||||
+#define __UTIL_UNIQUE_PTR_H__
|
||||
+
|
||||
+#include <memory>
|
||||
+
|
||||
+CCL_NAMESPACE_BEGIN
|
||||
+
|
||||
+using std::unique_ptr;
|
||||
+
|
||||
+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 @@
|
||||
#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)
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user