Skip to content

Commit

Permalink
RgbaInputFile: Multipart support test (AcademySoftwareFoundation#1194)
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs OROSZI <orobalage@gmail.com>
  • Loading branch information
ignus2 authored and cary-ilm committed Jan 18, 2022
1 parent e8da7e9 commit 0b9540d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib/OpenEXR/ImfMultiPartInputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class IMF_EXPORT_TYPE MultiPartInputFile : public GenericInputFile
friend class ScanLineInputFile;
friend class DeepScanLineInputFile;
friend class DeepTiledInputFile;

friend class RgbaInputFile;
};


Expand Down
20 changes: 19 additions & 1 deletion src/lib/OpenEXR/ImfRgbaFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <ImfRgbaFile.h>
#include <ImfOutputFile.h>
#include <ImfInputFile.h>
#include <ImfMultiPartInputFile.h>
#include <ImfChannelList.h>
#include <ImfRgbaYca.h>
#include <ImfStandardAttributes.h>
Expand Down Expand Up @@ -1164,6 +1165,20 @@ RgbaInputFile::RgbaInputFile (const char name[], int numThreads):
}


RgbaInputFile::RgbaInputFile (int partNumber, const char name[], int numThreads):
_inputFile (0),
_fromYca (0),
_channelNamePrefix ("")
{
_multiPartFile = new MultiPartInputFile(name, numThreads);
_inputFile = _multiPartFile->getInputPart<InputFile>(partNumber);
RgbaChannels rgbaChannels = channels();

if (rgbaChannels & (WRITE_Y | WRITE_C))
_fromYca = new FromYca (*_inputFile, rgbaChannels);
}


RgbaInputFile::RgbaInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThreads):
_inputFile (new InputFile (is, numThreads)),
_fromYca (0),
Expand Down Expand Up @@ -1208,7 +1223,10 @@ RgbaInputFile::RgbaInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,

RgbaInputFile::~RgbaInputFile ()
{
delete _inputFile;
if (_multiPartFile)
delete _multiPartFile;
else
delete _inputFile;
delete _fromYca;
}

Expand Down
5 changes: 5 additions & 0 deletions src/lib/OpenEXR/ImfRgbaFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ class IMF_EXPORT_TYPE RgbaInputFile
RgbaInputFile (const char name[], int numThreads = globalThreadCount());


IMF_EXPORT
RgbaInputFile (int partNumber, const char name[], int numThreads = globalThreadCount());


//-----------------------------------------------------------
// Constructor -- attaches the new RgbaInputFile object to a
// file that has already been opened by the caller.
Expand Down Expand Up @@ -412,6 +416,7 @@ class IMF_EXPORT_TYPE RgbaInputFile
InputFile * _inputFile;
FromYca * _fromYca;
std::string _channelNamePrefix;
MultiPartInputFile* _multiPartFile = nullptr;
};


Expand Down

0 comments on commit 0b9540d

Please sign in to comment.