Normalize line endings and whitespace
This commit is contained in:

committed by
Andrey Kamaev

parent
0442bca235
commit
81f826db2b
376
3rdparty/openexr/IlmImf/ImfTiledRgbaFile.cpp
vendored
376
3rdparty/openexr/IlmImf/ImfTiledRgbaFile.cpp
vendored
@@ -2,9 +2,9 @@
|
||||
//
|
||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||
// Digital Ltd. LLC
|
||||
//
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
@@ -16,8 +16,8 @@
|
||||
// distribution.
|
||||
// * Neither the name of Industrial Light & Magic nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -63,39 +63,39 @@ namespace {
|
||||
|
||||
void
|
||||
insertChannels (Header &header,
|
||||
RgbaChannels rgbaChannels,
|
||||
const char fileName[])
|
||||
RgbaChannels rgbaChannels,
|
||||
const char fileName[])
|
||||
{
|
||||
ChannelList ch;
|
||||
|
||||
if (rgbaChannels & (WRITE_Y | WRITE_C))
|
||||
{
|
||||
if (rgbaChannels & WRITE_Y)
|
||||
{
|
||||
ch.insert ("Y", Channel (HALF, 1, 1));
|
||||
}
|
||||
if (rgbaChannels & WRITE_Y)
|
||||
{
|
||||
ch.insert ("Y", Channel (HALF, 1, 1));
|
||||
}
|
||||
|
||||
if (rgbaChannels & WRITE_C)
|
||||
{
|
||||
THROW (Iex::ArgExc, "Cannot open file \"" << fileName << "\" "
|
||||
"for writing. Tiled image files do not "
|
||||
"support subsampled chroma channels.");
|
||||
}
|
||||
if (rgbaChannels & WRITE_C)
|
||||
{
|
||||
THROW (Iex::ArgExc, "Cannot open file \"" << fileName << "\" "
|
||||
"for writing. Tiled image files do not "
|
||||
"support subsampled chroma channels.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rgbaChannels & WRITE_R)
|
||||
ch.insert ("R", Channel (HALF, 1, 1));
|
||||
if (rgbaChannels & WRITE_R)
|
||||
ch.insert ("R", Channel (HALF, 1, 1));
|
||||
|
||||
if (rgbaChannels & WRITE_G)
|
||||
ch.insert ("G", Channel (HALF, 1, 1));
|
||||
if (rgbaChannels & WRITE_G)
|
||||
ch.insert ("G", Channel (HALF, 1, 1));
|
||||
|
||||
if (rgbaChannels & WRITE_B)
|
||||
ch.insert ("B", Channel (HALF, 1, 1));
|
||||
if (rgbaChannels & WRITE_B)
|
||||
ch.insert ("B", Channel (HALF, 1, 1));
|
||||
}
|
||||
|
||||
if (rgbaChannels & WRITE_A)
|
||||
ch.insert ("A", Channel (HALF, 1, 1));
|
||||
ch.insert ("A", Channel (HALF, 1, 1));
|
||||
|
||||
header.channels() = ch;
|
||||
}
|
||||
@@ -107,19 +107,19 @@ rgbaChannels (const ChannelList &ch, const string &channelNamePrefix = "")
|
||||
int i = 0;
|
||||
|
||||
if (ch.findChannel (channelNamePrefix + "R"))
|
||||
i |= WRITE_R;
|
||||
i |= WRITE_R;
|
||||
|
||||
if (ch.findChannel (channelNamePrefix + "G"))
|
||||
i |= WRITE_G;
|
||||
|
||||
i |= WRITE_G;
|
||||
|
||||
if (ch.findChannel (channelNamePrefix + "B"))
|
||||
i |= WRITE_B;
|
||||
i |= WRITE_B;
|
||||
|
||||
if (ch.findChannel (channelNamePrefix + "A"))
|
||||
i |= WRITE_A;
|
||||
i |= WRITE_A;
|
||||
|
||||
if (ch.findChannel (channelNamePrefix + "Y"))
|
||||
i |= WRITE_Y;
|
||||
i |= WRITE_Y;
|
||||
|
||||
return RgbaChannels (i);
|
||||
}
|
||||
@@ -129,10 +129,10 @@ string
|
||||
prefixFromLayerName (const string &layerName, const Header &header)
|
||||
{
|
||||
if (layerName.empty())
|
||||
return "";
|
||||
return "";
|
||||
|
||||
if (hasMultiView (header) && multiView(header)[0] == layerName)
|
||||
return "";
|
||||
return "";
|
||||
|
||||
return layerName + ".";
|
||||
}
|
||||
@@ -144,7 +144,7 @@ ywFromHeader (const Header &header)
|
||||
Chromaticities cr;
|
||||
|
||||
if (hasChromaticities (header))
|
||||
cr = chromaticities (header);
|
||||
cr = chromaticities (header);
|
||||
|
||||
return computeYw (cr);
|
||||
}
|
||||
@@ -159,8 +159,8 @@ class TiledRgbaOutputFile::ToYa: public Mutex
|
||||
ToYa (TiledOutputFile &outputFile, RgbaChannels rgbaChannels);
|
||||
|
||||
void setFrameBuffer (const Rgba *base,
|
||||
size_t xStride,
|
||||
size_t yStride);
|
||||
size_t xStride,
|
||||
size_t yStride);
|
||||
|
||||
void writeTile (int dx, int dy, int lx, int ly);
|
||||
|
||||
@@ -179,12 +179,12 @@ class TiledRgbaOutputFile::ToYa: public Mutex
|
||||
|
||||
|
||||
TiledRgbaOutputFile::ToYa::ToYa (TiledOutputFile &outputFile,
|
||||
RgbaChannels rgbaChannels)
|
||||
RgbaChannels rgbaChannels)
|
||||
:
|
||||
_outputFile (outputFile)
|
||||
{
|
||||
_writeA = (rgbaChannels & WRITE_A)? true: false;
|
||||
|
||||
|
||||
const TileDescription &td = outputFile.header().tileDescription();
|
||||
|
||||
_tileXSize = td.xSize;
|
||||
@@ -199,8 +199,8 @@ TiledRgbaOutputFile::ToYa::ToYa (TiledOutputFile &outputFile,
|
||||
|
||||
void
|
||||
TiledRgbaOutputFile::ToYa::setFrameBuffer (const Rgba *base,
|
||||
size_t xStride,
|
||||
size_t yStride)
|
||||
size_t xStride,
|
||||
size_t yStride)
|
||||
{
|
||||
_fbBase = base;
|
||||
_fbXStride = xStride;
|
||||
@@ -213,9 +213,9 @@ TiledRgbaOutputFile::ToYa::writeTile (int dx, int dy, int lx, int ly)
|
||||
{
|
||||
if (_fbBase == 0)
|
||||
{
|
||||
THROW (Iex::ArgExc, "No frame buffer was specified as the "
|
||||
"pixel data source for image file "
|
||||
"\"" << _outputFile.fileName() << "\".");
|
||||
THROW (Iex::ArgExc, "No frame buffer was specified as the "
|
||||
"pixel data source for image file "
|
||||
"\"" << _outputFile.fileName() << "\".");
|
||||
}
|
||||
|
||||
//
|
||||
@@ -228,10 +228,10 @@ TiledRgbaOutputFile::ToYa::writeTile (int dx, int dy, int lx, int ly)
|
||||
|
||||
for (int y = dw.min.y, y1 = 0; y <= dw.max.y; ++y, ++y1)
|
||||
{
|
||||
for (int x = dw.min.x, x1 = 0; x <= dw.max.x; ++x, ++x1)
|
||||
_buf[y1][x1] = _fbBase[x * _fbXStride + y * _fbYStride];
|
||||
for (int x = dw.min.x, x1 = 0; x <= dw.max.x; ++x, ++x1)
|
||||
_buf[y1][x1] = _fbBase[x * _fbXStride + y * _fbYStride];
|
||||
|
||||
RGBAtoYCA (_yw, width, _writeA, _buf[y1], _buf[y1]);
|
||||
RGBAtoYCA (_yw, width, _writeA, _buf[y1], _buf[y1]);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -241,14 +241,14 @@ TiledRgbaOutputFile::ToYa::writeTile (int dx, int dy, int lx, int ly)
|
||||
FrameBuffer fb;
|
||||
|
||||
fb.insert ("Y", Slice (HALF, // type
|
||||
(char *) &_buf[-dw.min.y][-dw.min.x].g, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize)); // yStride
|
||||
(char *) &_buf[-dw.min.y][-dw.min.x].g, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize)); // yStride
|
||||
|
||||
fb.insert ("A", Slice (HALF, // type
|
||||
(char *) &_buf[-dw.min.y][-dw.min.x].a, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize)); // yStride
|
||||
(char *) &_buf[-dw.min.y][-dw.min.x].a, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize)); // yStride
|
||||
|
||||
_outputFile.setFrameBuffer (fb);
|
||||
_outputFile.writeTile (dx, dy, lx, ly);
|
||||
@@ -274,7 +274,7 @@ TiledRgbaOutputFile::TiledRgbaOutputFile
|
||||
_outputFile = new TiledOutputFile (name, hd, numThreads);
|
||||
|
||||
if (rgbaChannels & WRITE_Y)
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
}
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ TiledRgbaOutputFile::TiledRgbaOutputFile
|
||||
_outputFile = new TiledOutputFile (os, hd, numThreads);
|
||||
|
||||
if (rgbaChannels & WRITE_Y)
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
}
|
||||
|
||||
|
||||
@@ -323,19 +323,19 @@ TiledRgbaOutputFile::TiledRgbaOutputFile
|
||||
_toYa (0)
|
||||
{
|
||||
Header hd (displayWindow,
|
||||
dataWindow.isEmpty()? displayWindow: dataWindow,
|
||||
pixelAspectRatio,
|
||||
screenWindowCenter,
|
||||
screenWindowWidth,
|
||||
lineOrder,
|
||||
compression);
|
||||
dataWindow.isEmpty()? displayWindow: dataWindow,
|
||||
pixelAspectRatio,
|
||||
screenWindowCenter,
|
||||
screenWindowWidth,
|
||||
lineOrder,
|
||||
compression);
|
||||
|
||||
insertChannels (hd, rgbaChannels, name);
|
||||
hd.setTileDescription (TileDescription (tileXSize, tileYSize, mode, rmode));
|
||||
_outputFile = new TiledOutputFile (name, hd, numThreads);
|
||||
|
||||
if (rgbaChannels & WRITE_Y)
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
}
|
||||
|
||||
|
||||
@@ -359,19 +359,19 @@ TiledRgbaOutputFile::TiledRgbaOutputFile
|
||||
_toYa (0)
|
||||
{
|
||||
Header hd (width,
|
||||
height,
|
||||
pixelAspectRatio,
|
||||
screenWindowCenter,
|
||||
screenWindowWidth,
|
||||
lineOrder,
|
||||
compression);
|
||||
height,
|
||||
pixelAspectRatio,
|
||||
screenWindowCenter,
|
||||
screenWindowWidth,
|
||||
lineOrder,
|
||||
compression);
|
||||
|
||||
insertChannels (hd, rgbaChannels, name);
|
||||
hd.setTileDescription (TileDescription (tileXSize, tileYSize, mode, rmode));
|
||||
_outputFile = new TiledOutputFile (name, hd, numThreads);
|
||||
|
||||
if (rgbaChannels & WRITE_Y)
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
_toYa = new ToYa (*_outputFile, rgbaChannels);
|
||||
}
|
||||
|
||||
|
||||
@@ -384,27 +384,27 @@ TiledRgbaOutputFile::~TiledRgbaOutputFile ()
|
||||
|
||||
void
|
||||
TiledRgbaOutputFile::setFrameBuffer (const Rgba *base,
|
||||
size_t xStride,
|
||||
size_t yStride)
|
||||
size_t xStride,
|
||||
size_t yStride)
|
||||
{
|
||||
if (_toYa)
|
||||
{
|
||||
Lock lock (*_toYa);
|
||||
_toYa->setFrameBuffer (base, xStride, yStride);
|
||||
Lock lock (*_toYa);
|
||||
_toYa->setFrameBuffer (base, xStride, yStride);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t xs = xStride * sizeof (Rgba);
|
||||
size_t ys = yStride * sizeof (Rgba);
|
||||
size_t xs = xStride * sizeof (Rgba);
|
||||
size_t ys = yStride * sizeof (Rgba);
|
||||
|
||||
FrameBuffer fb;
|
||||
FrameBuffer fb;
|
||||
|
||||
fb.insert ("R", Slice (HALF, (char *) &base[0].r, xs, ys));
|
||||
fb.insert ("G", Slice (HALF, (char *) &base[0].g, xs, ys));
|
||||
fb.insert ("B", Slice (HALF, (char *) &base[0].b, xs, ys));
|
||||
fb.insert ("A", Slice (HALF, (char *) &base[0].a, xs, ys));
|
||||
fb.insert ("R", Slice (HALF, (char *) &base[0].r, xs, ys));
|
||||
fb.insert ("G", Slice (HALF, (char *) &base[0].g, xs, ys));
|
||||
fb.insert ("B", Slice (HALF, (char *) &base[0].b, xs, ys));
|
||||
fb.insert ("A", Slice (HALF, (char *) &base[0].a, xs, ys));
|
||||
|
||||
_outputFile->setFrameBuffer (fb);
|
||||
_outputFile->setFrameBuffer (fb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ TiledRgbaOutputFile::dataWindow () const
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
float
|
||||
TiledRgbaOutputFile::pixelAspectRatio () const
|
||||
{
|
||||
return _outputFile->header().pixelAspectRatio();
|
||||
@@ -451,7 +451,7 @@ TiledRgbaOutputFile::screenWindowCenter () const
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
float
|
||||
TiledRgbaOutputFile::screenWindowWidth () const
|
||||
{
|
||||
return _outputFile->header().screenWindowWidth();
|
||||
@@ -596,12 +596,12 @@ TiledRgbaOutputFile::writeTile (int dx, int dy, int l)
|
||||
{
|
||||
if (_toYa)
|
||||
{
|
||||
Lock lock (*_toYa);
|
||||
_toYa->writeTile (dx, dy, l, l);
|
||||
Lock lock (*_toYa);
|
||||
_toYa->writeTile (dx, dy, l, l);
|
||||
}
|
||||
else
|
||||
{
|
||||
_outputFile->writeTile (dx, dy, l);
|
||||
_outputFile->writeTile (dx, dy, l);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,27 +611,27 @@ TiledRgbaOutputFile::writeTile (int dx, int dy, int lx, int ly)
|
||||
{
|
||||
if (_toYa)
|
||||
{
|
||||
Lock lock (*_toYa);
|
||||
_toYa->writeTile (dx, dy, lx, ly);
|
||||
Lock lock (*_toYa);
|
||||
_toYa->writeTile (dx, dy, lx, ly);
|
||||
}
|
||||
else
|
||||
{
|
||||
_outputFile->writeTile (dx, dy, lx, ly);
|
||||
_outputFile->writeTile (dx, dy, lx, ly);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaOutputFile::writeTiles
|
||||
(int dxMin, int dxMax, int dyMin, int dyMax, int lx, int ly)
|
||||
{
|
||||
if (_toYa)
|
||||
{
|
||||
Lock lock (*_toYa);
|
||||
Lock lock (*_toYa);
|
||||
|
||||
for (int dy = dyMin; dy <= dyMax; dy++)
|
||||
for (int dx = dxMin; dx <= dxMax; dx++)
|
||||
_toYa->writeTile (dx, dy, lx, ly);
|
||||
_toYa->writeTile (dx, dy, lx, ly);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -639,7 +639,7 @@ TiledRgbaOutputFile::writeTiles
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaOutputFile::writeTiles
|
||||
(int dxMin, int dxMax, int dyMin, int dyMax, int l)
|
||||
{
|
||||
@@ -654,9 +654,9 @@ class TiledRgbaInputFile::FromYa: public Mutex
|
||||
FromYa (TiledInputFile &inputFile);
|
||||
|
||||
void setFrameBuffer (Rgba *base,
|
||||
size_t xStride,
|
||||
size_t yStride,
|
||||
const string &channelNamePrefix);
|
||||
size_t xStride,
|
||||
size_t yStride,
|
||||
const string &channelNamePrefix);
|
||||
|
||||
void readTile (int dx, int dy, int lx, int ly);
|
||||
|
||||
@@ -691,33 +691,33 @@ TiledRgbaInputFile::FromYa::FromYa (TiledInputFile &inputFile)
|
||||
|
||||
void
|
||||
TiledRgbaInputFile::FromYa::setFrameBuffer (Rgba *base,
|
||||
size_t xStride,
|
||||
size_t yStride,
|
||||
const string &channelNamePrefix)
|
||||
size_t xStride,
|
||||
size_t yStride,
|
||||
const string &channelNamePrefix)
|
||||
{
|
||||
if (_fbBase == 0)
|
||||
{
|
||||
FrameBuffer fb;
|
||||
FrameBuffer fb;
|
||||
|
||||
fb.insert (channelNamePrefix + "Y",
|
||||
Slice (HALF, // type
|
||||
(char *) &_buf[0][0].g, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize, // yStride
|
||||
1, 1, // sampling
|
||||
0.0, // fillValue
|
||||
true, true)); // tileCoordinates
|
||||
fb.insert (channelNamePrefix + "Y",
|
||||
Slice (HALF, // type
|
||||
(char *) &_buf[0][0].g, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize, // yStride
|
||||
1, 1, // sampling
|
||||
0.0, // fillValue
|
||||
true, true)); // tileCoordinates
|
||||
|
||||
fb.insert (channelNamePrefix + "A",
|
||||
Slice (HALF, // type
|
||||
(char *) &_buf[0][0].a, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize, // yStride
|
||||
1, 1, // sampling
|
||||
1.0, // fillValue
|
||||
true, true)); // tileCoordinates
|
||||
fb.insert (channelNamePrefix + "A",
|
||||
Slice (HALF, // type
|
||||
(char *) &_buf[0][0].a, // base
|
||||
sizeof (Rgba), // xStride
|
||||
sizeof (Rgba) * _tileXSize, // yStride
|
||||
1, 1, // sampling
|
||||
1.0, // fillValue
|
||||
true, true)); // tileCoordinates
|
||||
|
||||
_inputFile.setFrameBuffer (fb);
|
||||
_inputFile.setFrameBuffer (fb);
|
||||
}
|
||||
|
||||
_fbBase = base;
|
||||
@@ -731,15 +731,15 @@ TiledRgbaInputFile::FromYa::readTile (int dx, int dy, int lx, int ly)
|
||||
{
|
||||
if (_fbBase == 0)
|
||||
{
|
||||
THROW (Iex::ArgExc, "No frame buffer was specified as the "
|
||||
"pixel data destination for image file "
|
||||
"\"" << _inputFile.fileName() << "\".");
|
||||
THROW (Iex::ArgExc, "No frame buffer was specified as the "
|
||||
"pixel data destination for image file "
|
||||
"\"" << _inputFile.fileName() << "\".");
|
||||
}
|
||||
|
||||
//
|
||||
// Read the tile requested by the caller into _buf.
|
||||
//
|
||||
|
||||
|
||||
_inputFile.readTile (dx, dy, lx, ly);
|
||||
|
||||
//
|
||||
@@ -752,18 +752,18 @@ TiledRgbaInputFile::FromYa::readTile (int dx, int dy, int lx, int ly)
|
||||
|
||||
for (int y = dw.min.y, y1 = 0; y <= dw.max.y; ++y, ++y1)
|
||||
{
|
||||
for (int x1 = 0; x1 < width; ++x1)
|
||||
{
|
||||
_buf[y1][x1].r = 0;
|
||||
_buf[y1][x1].b = 0;
|
||||
}
|
||||
for (int x1 = 0; x1 < width; ++x1)
|
||||
{
|
||||
_buf[y1][x1].r = 0;
|
||||
_buf[y1][x1].b = 0;
|
||||
}
|
||||
|
||||
YCAtoRGBA (_yw, width, _buf[y1], _buf[y1]);
|
||||
YCAtoRGBA (_yw, width, _buf[y1], _buf[y1]);
|
||||
|
||||
for (int x = dw.min.x, x1 = 0; x <= dw.max.x; ++x, ++x1)
|
||||
{
|
||||
_fbBase[x * _fbXStride + y * _fbYStride] = _buf[y1][x1];
|
||||
}
|
||||
for (int x = dw.min.x, x1 = 0; x <= dw.max.x; ++x, ++x1)
|
||||
{
|
||||
_fbBase[x * _fbXStride + y * _fbYStride] = _buf[y1][x1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -774,7 +774,7 @@ TiledRgbaInputFile::TiledRgbaInputFile (const char name[], int numThreads):
|
||||
_channelNamePrefix ("")
|
||||
{
|
||||
if (channels() & WRITE_Y)
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -784,33 +784,33 @@ TiledRgbaInputFile::TiledRgbaInputFile (IStream &is, int numThreads):
|
||||
_channelNamePrefix ("")
|
||||
{
|
||||
if (channels() & WRITE_Y)
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
}
|
||||
|
||||
|
||||
TiledRgbaInputFile::TiledRgbaInputFile (const char name[],
|
||||
const string &layerName,
|
||||
int numThreads)
|
||||
const string &layerName,
|
||||
int numThreads)
|
||||
:
|
||||
_inputFile (new TiledInputFile (name, numThreads)),
|
||||
_fromYa (0),
|
||||
_channelNamePrefix (prefixFromLayerName (layerName, _inputFile->header()))
|
||||
{
|
||||
if (channels() & WRITE_Y)
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
}
|
||||
|
||||
|
||||
TiledRgbaInputFile::TiledRgbaInputFile (IStream &is,
|
||||
const string &layerName,
|
||||
int numThreads)
|
||||
const string &layerName,
|
||||
int numThreads)
|
||||
:
|
||||
_inputFile (new TiledInputFile (is, numThreads)),
|
||||
_fromYa (0),
|
||||
_channelNamePrefix (prefixFromLayerName (layerName, _inputFile->header()))
|
||||
{
|
||||
if (channels() & WRITE_Y)
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -821,64 +821,64 @@ TiledRgbaInputFile::~TiledRgbaInputFile ()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaInputFile::setFrameBuffer (Rgba *base, size_t xStride, size_t yStride)
|
||||
{
|
||||
if (_fromYa)
|
||||
{
|
||||
Lock lock (*_fromYa);
|
||||
_fromYa->setFrameBuffer (base, xStride, yStride, _channelNamePrefix);
|
||||
Lock lock (*_fromYa);
|
||||
_fromYa->setFrameBuffer (base, xStride, yStride, _channelNamePrefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t xs = xStride * sizeof (Rgba);
|
||||
size_t ys = yStride * sizeof (Rgba);
|
||||
size_t xs = xStride * sizeof (Rgba);
|
||||
size_t ys = yStride * sizeof (Rgba);
|
||||
|
||||
FrameBuffer fb;
|
||||
FrameBuffer fb;
|
||||
|
||||
fb.insert (_channelNamePrefix + "R",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].r,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
0.0)); // fillValue
|
||||
fb.insert (_channelNamePrefix + "R",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].r,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
0.0)); // fillValue
|
||||
|
||||
fb.insert (_channelNamePrefix + "G",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].g,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
0.0)); // fillValue
|
||||
fb.insert (_channelNamePrefix + "G",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].g,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
0.0)); // fillValue
|
||||
|
||||
fb.insert (_channelNamePrefix + "B",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].b,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
0.0)); // fillValue
|
||||
fb.insert (_channelNamePrefix + "B",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].b,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
0.0)); // fillValue
|
||||
|
||||
fb.insert (_channelNamePrefix + "A",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].a,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
1.0)); // fillValue
|
||||
fb.insert (_channelNamePrefix + "A",
|
||||
Slice (HALF,
|
||||
(char *) &base[0].a,
|
||||
xs, ys,
|
||||
1, 1, // xSampling, ySampling
|
||||
1.0)); // fillValue
|
||||
|
||||
_inputFile->setFrameBuffer (fb);
|
||||
_inputFile->setFrameBuffer (fb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaInputFile::setLayerName (const std::string &layerName)
|
||||
{
|
||||
delete _fromYa;
|
||||
_fromYa = 0;
|
||||
|
||||
|
||||
_channelNamePrefix = prefixFromLayerName (layerName, _inputFile->header());
|
||||
|
||||
if (channels() & WRITE_Y)
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
_fromYa = new FromYa (*_inputFile);
|
||||
|
||||
FrameBuffer fb;
|
||||
_inputFile->setFrameBuffer (fb);
|
||||
@@ -899,7 +899,7 @@ TiledRgbaInputFile::fileName () const
|
||||
}
|
||||
|
||||
|
||||
const FrameBuffer &
|
||||
const FrameBuffer &
|
||||
TiledRgbaInputFile::frameBuffer () const
|
||||
{
|
||||
return _inputFile->frameBuffer();
|
||||
@@ -920,21 +920,21 @@ TiledRgbaInputFile::dataWindow () const
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
float
|
||||
TiledRgbaInputFile::pixelAspectRatio () const
|
||||
{
|
||||
return _inputFile->header().pixelAspectRatio();
|
||||
}
|
||||
|
||||
|
||||
const Imath::V2f
|
||||
const Imath::V2f
|
||||
TiledRgbaInputFile::screenWindowCenter () const
|
||||
{
|
||||
return _inputFile->header().screenWindowCenter();
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
float
|
||||
TiledRgbaInputFile::screenWindowWidth () const
|
||||
{
|
||||
return _inputFile->header().screenWindowWidth();
|
||||
@@ -955,7 +955,7 @@ TiledRgbaInputFile::compression () const
|
||||
}
|
||||
|
||||
|
||||
RgbaChannels
|
||||
RgbaChannels
|
||||
TiledRgbaInputFile::channels () const
|
||||
{
|
||||
return rgbaChannels (_inputFile->header().channels(), _channelNamePrefix);
|
||||
@@ -1093,12 +1093,12 @@ TiledRgbaInputFile::readTile (int dx, int dy, int l)
|
||||
{
|
||||
if (_fromYa)
|
||||
{
|
||||
Lock lock (*_fromYa);
|
||||
_fromYa->readTile (dx, dy, l, l);
|
||||
Lock lock (*_fromYa);
|
||||
_fromYa->readTile (dx, dy, l, l);
|
||||
}
|
||||
else
|
||||
{
|
||||
_inputFile->readTile (dx, dy, l);
|
||||
_inputFile->readTile (dx, dy, l);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1108,27 +1108,27 @@ TiledRgbaInputFile::readTile (int dx, int dy, int lx, int ly)
|
||||
{
|
||||
if (_fromYa)
|
||||
{
|
||||
Lock lock (*_fromYa);
|
||||
_fromYa->readTile (dx, dy, lx, ly);
|
||||
Lock lock (*_fromYa);
|
||||
_fromYa->readTile (dx, dy, lx, ly);
|
||||
}
|
||||
else
|
||||
{
|
||||
_inputFile->readTile (dx, dy, lx, ly);
|
||||
_inputFile->readTile (dx, dy, lx, ly);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaInputFile::readTiles (int dxMin, int dxMax, int dyMin, int dyMax,
|
||||
int lx, int ly)
|
||||
{
|
||||
if (_fromYa)
|
||||
{
|
||||
Lock lock (*_fromYa);
|
||||
Lock lock (*_fromYa);
|
||||
|
||||
for (int dy = dyMin; dy <= dyMax; dy++)
|
||||
for (int dx = dxMin; dx <= dxMax; dx++)
|
||||
_fromYa->readTile (dx, dy, lx, ly);
|
||||
_fromYa->readTile (dx, dy, lx, ly);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1136,7 +1136,7 @@ TiledRgbaInputFile::readTiles (int dxMin, int dxMax, int dyMin, int dyMax,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaInputFile::readTiles (int dxMin, int dxMax, int dyMin, int dyMax,
|
||||
int l)
|
||||
{
|
||||
@@ -1144,16 +1144,16 @@ TiledRgbaInputFile::readTiles (int dxMin, int dxMax, int dyMin, int dyMax,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaOutputFile::updatePreviewImage (const PreviewRgba newPixels[])
|
||||
{
|
||||
_outputFile->updatePreviewImage (newPixels);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
TiledRgbaOutputFile::breakTile (int dx, int dy, int lx, int ly,
|
||||
int offset, int length, char c)
|
||||
int offset, int length, char c)
|
||||
{
|
||||
_outputFile->breakTile (dx, dy, lx, ly, offset, length, c);
|
||||
}
|
||||
|
Reference in New Issue
Block a user