diff --git a/vcl/inc/filter/PcxReader.hxx b/vcl/inc/filter/PcxReader.hxx index 73e182c62895..4ecef879c07f 100644 --- a/vcl/inc/filter/PcxReader.hxx +++ b/vcl/inc/filter/PcxReader.hxx @@ -19,8 +19,9 @@ #pragma once -#include +class SvStream; +class ImportOutput; -VCL_DLLPUBLIC bool ImportPcxGraphic(SvStream& rStream, Graphic& rGraphic); +VCL_DLLPUBLIC bool ImportPcxGraphic(SvStream& rStream, ImportOutput& rImportOutput); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx index 5297631517da..901ba1839ed6 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include using namespace css; @@ -44,8 +44,8 @@ bool PcxFilterTest::load(const OUString &, SfxFilterFlags, SotClipboardFormatId, unsigned int) { SvFileStream aFileStream(rURL, StreamMode::READ); - Graphic aGraphic; - return ImportPcxGraphic(aFileStream, aGraphic); + ImportOutput aImportOutput; + return ImportPcxGraphic(aFileStream, aImportOutput); } void PcxFilterTest::testCVEs() diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index dde6a0ffa75f..3e512777198c 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1234,8 +1234,12 @@ ErrCode GraphicFilter::readRAS(SvStream & rStream, Graphic & rGraphic) ErrCode GraphicFilter::readPCX(SvStream & rStream, Graphic & rGraphic) { - if (ImportPcxGraphic(rStream, rGraphic)) + ImportOutput aImportOutput; + if (ImportPcxGraphic(rStream, aImportOutput)) + { + rGraphic = Graphic(*aImportOutput.moBitmap); return ERRCODE_NONE; + } else return ERRCODE_GRFILTER_FILTERERROR; } diff --git a/vcl/source/filter/ipcx/ipcx.cxx b/vcl/source/filter/ipcx/ipcx.cxx index b1162d5ec409..202c134bac28 100644 --- a/vcl/source/filter/ipcx/ipcx.cxx +++ b/vcl/source/filter/ipcx/ipcx.cxx @@ -19,7 +19,7 @@ #include -#include +#include #include #include #include @@ -58,7 +58,7 @@ private: public: explicit PCXReader(SvStream &rStream); - bool ReadPCX(Graphic & rGraphic ); + bool ReadPCX(ImportOutput& rImportOutput); // Reads a PCX file from the stream and fills the GDIMetaFile }; @@ -83,7 +83,7 @@ PCXReader::PCXReader(SvStream &rStream) { } -bool PCXReader::ReadPCX(Graphic & rGraphic) +bool PCXReader::ReadPCX(ImportOutput& rImportOutput) { if ( m_rPCX.GetError() ) return false; @@ -143,7 +143,7 @@ bool PCXReader::ReadPCX(Graphic & rGraphic) if ( bStatus ) { - rGraphic = vcl::bitmap::CreateFromData(std::move(*mpBitmap)); + rImportOutput.moBitmap = vcl::bitmap::CreateFromData(std::move(*mpBitmap)); return true; } } @@ -399,10 +399,10 @@ void PCXReader::ImplReadPalette( unsigned int nCol ) //================== GraphicImport - the exported function ================ -bool ImportPcxGraphic(SvStream & rStream, Graphic & rGraphic) +bool ImportPcxGraphic(SvStream& rStream, ImportOutput& rImportOutput) { PCXReader aPCXReader(rStream); - bool bRetValue = aPCXReader.ReadPCX(rGraphic); + bool bRetValue = aPCXReader.ReadPCX(rImportOutput); if ( !bRetValue ) rStream.SetError( SVSTREAM_FILEFORMAT_ERROR ); return bRetValue; diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx index 26ad84ca6e22..b78ea9ec9b60 100644 --- a/vcl/workben/fftester.cxx +++ b/vcl/workben/fftester.cxx @@ -226,9 +226,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } else if (strcmp(argv[2], "pcx") == 0) { - Graphic aGraphic; + ImportOutput aImportOutput; SvFileStream aFileStream(out, StreamMode::READ); - ret = static_cast(ImportPcxGraphic(aFileStream, aGraphic)); + ret = static_cast(ImportPcxGraphic(aFileStream, aImportOutput)); } else if (strcmp(argv[2], "ras") == 0) { diff --git a/vcl/workben/pcxfuzzer.cxx b/vcl/workben/pcxfuzzer.cxx index 2785cf4c4eec..83840b01d16a 100644 --- a/vcl/workben/pcxfuzzer.cxx +++ b/vcl/workben/pcxfuzzer.cxx @@ -49,8 +49,8 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { SvMemoryStream aStream(const_cast(data), size, StreamMode::READ); - Graphic aGraphic; - (void)ImportPcxGraphic(aStream, aGraphic); + ImportOutput aImportOutput; + (void)ImportPcxGraphic(aStream, aImportOutput); return 0; }