Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix opening large exr files on qt5

Luna Lovecraft84b46117551a
diff --git a/plugins/impex/exr/exr_converter.cc b/plugins/impex/exr/exr_converter.cc
index 677bca04fc..f98581dff5 100644
--- a/plugins/impex/exr/exr_converter.cc
+++ b/plugins/impex/exr/exr_converter.cc
@@ -379,12 +379,12 @@ void EXRConverter::Private::decodeData4(Imf::InputFile& file, ExrPaintLayerInfo&
{
typedef Rgba<_T_> Rgba;
- QVector<Rgba> pixels(width * height);
+ std::unique_ptr<Rgba[]> pixels(new Rgba[width * height]);
bool hasAlpha = info.channelMap.contains("A");
Imf::FrameBuffer frameBuffer;
- Rgba* frameBufferData = (pixels.data()) - xstart - ystart * width;
+ Rgba* frameBufferData = pixels.get() - xstart - ystart * width;
frameBuffer.insert(info.channelMap["R"].toLatin1().constData(),
Imf::Slice(ptype, (char *) &frameBufferData->r,
sizeof(Rgba) * 1,
@@ -406,7 +406,7 @@ void EXRConverter::Private::decodeData4(Imf::InputFile& file, ExrPaintLayerInfo&
file.setFrameBuffer(frameBuffer);
file.readPixels(ystart, height + ystart - 1);
- Rgba *rgba = pixels.data();
+ Rgba *rgba = pixels.get();
QRect paintRegion(xstart, ystart, width, height);
KisSequentialIterator it(layer->paintDevice(), paintRegion);