include/vcl/vectorgraphicdata.hxx | 2 -- vcl/source/filter/graphicfilter.cxx | 20 ++++++++++---------- vcl/source/gdi/vectorgraphicdata.cxx | 7 +++---- 3 files changed, 13 insertions(+), 16 deletions(-)
New commits: commit a31f61e233a08025c0acaeabd02c12981258c83d Author: Mike Kaganski <[email protected]> AuthorDate: Tue Mar 7 09:50:11 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Tue Mar 7 08:30:54 2023 +0000 Drop VectorGraphicDataArray Change-Id: If444317edf35d0627c6bc3a8c36ba973a8a0af8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148371 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx index 0e9f9fec20e7..bfa30b7af3bc 100644 --- a/include/vcl/vectorgraphicdata.hxx +++ b/include/vcl/vectorgraphicdata.hxx @@ -32,8 +32,6 @@ namespace com::sun::star::graphic { class XPrimitive2D; } -typedef css::uno::Sequence<sal_Int8> VectorGraphicDataArray; - // helper to convert any Primitive2DSequence to a good quality BitmapEx, // using default parameters and graphic::XPrimitive2DRenderer diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index ef9f45485565..aab76c8968de 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1054,18 +1054,18 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkTy if (!rStream.GetError() && nMemoryLength >= 0) { - VectorGraphicDataArray aNewData(nMemoryLength); + auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nMemoryLength); aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemStream.ReadBytes(aNewData.getArray(), nMemoryLength); + aMemStream.ReadBytes(aNewData->data(), aNewData->size()); // Make a uncompressed copy for GfxLink rGraphicContentSize = nMemoryLength; rpGraphicContent.reset(new sal_uInt8[rGraphicContentSize]); - std::copy(std::cbegin(aNewData), std::cend(aNewData), rpGraphicContent.get()); + std::copy(std::cbegin(*aNewData), std::cend(*aNewData), rpGraphicContent.get()); if (!aMemStream.GetError()) { - BinaryDataContainer aDataContainer(reinterpret_cast<const sal_uInt8*>(aNewData.getConstArray()), aNewData.getLength()); + BinaryDataContainer aDataContainer(std::move(aNewData)); auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; @@ -1074,12 +1074,12 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkTy } else { - VectorGraphicDataArray aNewData(nStreamLength); - rStream.ReadBytes(aNewData.getArray(), nStreamLength); + auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); + rStream.ReadBytes(aNewData->data(), aNewData->size()); if (!rStream.GetError()) { - BinaryDataContainer aDataContainer(reinterpret_cast<const sal_uInt8*>(aNewData.getConstArray()), aNewData.getLength()); + BinaryDataContainer aDataContainer(std::move(aNewData)); auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; @@ -1137,12 +1137,12 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, Graphic & rGraphic, GfxLi aNewStream = &aMemStream; } } - VectorGraphicDataArray aNewData(nStreamLength); - aNewStream->ReadBytes(aNewData.getArray(), nStreamLength); + auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); + aNewStream->ReadBytes(aNewData->data(), aNewData->size()); if (!aNewStream->GetError()) { const VectorGraphicDataType aDataType(eType); - BinaryDataContainer aDataContainer(reinterpret_cast<const sal_uInt8*>(aNewData.getConstArray()), aNewData.getLength()); + BinaryDataContainer aDataContainer(std::move(aNewData)); auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, aDataType); diff --git a/vcl/source/gdi/vectorgraphicdata.cxx b/vcl/source/gdi/vectorgraphicdata.cxx index 27479f3b0c34..e55cd14784e0 100644 --- a/vcl/source/gdi/vectorgraphicdata.cxx +++ b/vcl/source/gdi/vectorgraphicdata.cxx @@ -319,13 +319,12 @@ VectorGraphicData::VectorGraphicData( const sal_uInt32 nStmLen(rIStm.remainingSize()); if (nStmLen) { - VectorGraphicDataArray aVectorGraphicDataArray(nStmLen); - auto pData = aVectorGraphicDataArray.getArray(); - rIStm.ReadBytes(pData, nStmLen); + auto pData = std::make_unique<std::vector<sal_uInt8>>(nStmLen); + rIStm.ReadBytes(pData->data(), pData->size()); if (!rIStm.GetError()) { - maDataContainer = BinaryDataContainer(reinterpret_cast<const sal_uInt8*>(pData), nStmLen); + maDataContainer = BinaryDataContainer(std::move(pData)); } } }
