include/vcl/graph.hxx | 1 include/vcl/pdfread.hxx | 5 - sd/source/filter/pdf/sdpdffilter.cxx | 5 - vcl/inc/impgraph.hxx | 3 vcl/source/filter/graphicfilter.cxx | 2 vcl/source/filter/ipdf/pdfread.cxx | 125 +++++++++++++++-------------------- vcl/source/gdi/graph.cxx | 6 - vcl/source/gdi/impgraph.cxx | 82 +++++++--------------- vcl/source/gdi/pdfextoutdevdata.cxx | 2 9 files changed, 87 insertions(+), 144 deletions(-)
New commits: commit bb4f5258a221dd6c429d94686f1641377d61b951 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Thu Mar 28 09:07:13 2019 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Thu Mar 28 09:07:13 2019 +0100 Revert "vcl: share GfxLink" This reverts commit c8f81dbb30e89a19bb7a82f8b52cc02b9049e717. diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index a4747456123b..26d7c70bdd54 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -111,8 +111,7 @@ bool SdPdfFilter::Import() const size_t nGraphicContentSize = aPdfData.getLength(); std::unique_ptr<sal_uInt8[]> pGraphicContent(new sal_uInt8[nGraphicContentSize]); memcpy(pGraphicContent.get(), aPdfData.get(), nGraphicContentSize); - std::shared_ptr<GfxLink> pGfxLink(std::make_shared<GfxLink>( - std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf)); + GfxLink aGfxLink(std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf); auto pPdfData = std::make_shared<uno::Sequence<sal_Int8>>(aPdfData); mrDocument.CreateFirstPages(); diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index c462dc2c67ac..1a8563e95db0 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -45,7 +45,7 @@ private: std::unique_ptr<Animation> mpAnimation; std::shared_ptr<GraphicReader> mpContext; std::shared_ptr<ImpSwapFile> mpSwapFile; - std::shared_ptr<GfxLink> mpGfxLink; + std::unique_ptr<GfxLink> mpGfxLink; GraphicType meType; mutable sal_uLong mnSizeBytes; bool mbSwapOut; @@ -160,7 +160,7 @@ private: bool ImplIsSwapOut() const { return mbSwapOut;} bool ImplIsDummyContext() const { return mbDummyContext; } - void ImplSetLink( const std::shared_ptr<GfxLink>& ); + void ImplSetLink( const GfxLink& ); GfxLink ImplGetLink(); bool ImplIsLink() const; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 7a869a7aee4b..e7f86486d792 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1854,7 +1854,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, } if( nStatus == ERRCODE_NONE ) { - rGraphic.SetLink(GfxLink(std::move(pGraphicContent), nGraphicContentSize, eLinkType)); + rGraphic.SetLink( GfxLink( std::move(pGraphicContent), nGraphicContentSize, eLinkType ) ); } } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 2d73357ec43d..8027d0d85b1d 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -115,7 +115,6 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic) , maSwapInfo(rImpGraphic.maSwapInfo) , mpContext(rImpGraphic.mpContext) , mpSwapFile(rImpGraphic.mpSwapFile) - , mpGfxLink(rImpGraphic.mpGfxLink) , meType(rImpGraphic.meType) , mnSizeBytes(rImpGraphic.mnSizeBytes) , mbSwapOut(rImpGraphic.mbSwapOut) @@ -125,6 +124,9 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic) , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink) , mnPageNumber(rImpGraphic.mnPageNumber) { + if( rImpGraphic.mpGfxLink ) + mpGfxLink = o3tl::make_unique<GfxLink>( *rImpGraphic.mpGfxLink ); + if( rImpGraphic.mpAnimation ) { mpAnimation = o3tl::make_unique<Animation>( *rImpGraphic.mpAnimation ); @@ -237,7 +239,10 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic ) mbSwapOut = rImpGraphic.mbSwapOut; mpSwapFile = rImpGraphic.mpSwapFile; - mpGfxLink = rImpGraphic.mpGfxLink; + mpGfxLink.reset(); + + if( rImpGraphic.mpGfxLink ) + mpGfxLink = o3tl::make_unique<GfxLink>( *rImpGraphic.mpGfxLink ); maVectorGraphicData = rImpGraphic.maVectorGraphicData; mpPdfData = rImpGraphic.mpPdfData; @@ -1365,11 +1370,11 @@ bool ImpGraphic::ImplSwapIn( SvStream* xIStm ) return bRet; } -void ImpGraphic::ImplSetLink(const GfxLink& rGfxLink) +void ImpGraphic::ImplSetLink( const GfxLink& rGfxLink ) { - mpGfxLink = rGfxLink; + mpGfxLink = o3tl::make_unique<GfxLink>( rGfxLink ); - if (mpGfxLink && mpGfxLink->IsNative()) + if( mpGfxLink->IsNative() ) mpGfxLink->SwapOut(); } @@ -1484,7 +1489,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) // set dummy link to avoid creation of additional link after filtering; // we set a default link to avoid unnecessary swapping of native data - aGraphic.SetLink(GfxLink()); + aGraphic.SetLink( GfxLink() ); if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) ) { @@ -1501,7 +1506,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() ); if( bSetLink ) - rImpGraphic.ImplSetLink(aLink); + rImpGraphic.ImplSetLink( aLink ); } else { diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 73581f04ca3f..d74996ce2403 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -846,7 +846,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic, // 4 means CMYK, which is not handled. return false; - const Size aSize = rGraphic.GetSizePixel(); + Size aSize = rGraphic.GetSizePixel(); // small items better off as PNG anyway if ( aSize.Width() < 32 && commit a0ac37b9bc45c6016336447ab2ff5a5a251d5bdc Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Thu Mar 28 09:07:05 2019 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Thu Mar 28 09:07:05 2019 +0100 Revert "pdfium: Share the GfxLink for PDF files." This reverts commit 62654a8c29b945d00afe9f32e87b44ba0d8b84a2. diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 881abda221e4..45268462155a 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -216,7 +216,6 @@ private: public: void SetLink( const GfxLink& ); - void SetSharedLink(const std::shared_ptr<GfxLink>& pGfxLink); GfxLink GetLink() const; bool IsLink() const; diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 95daaeb479f1..a4747456123b 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -128,7 +128,7 @@ bool SdPdfFilter::Import() Graphic aGraphic(aBitmap); aGraphic.setPdfData(pPdfData); aGraphic.setPageNumber(nPageNumber); - aGraphic.SetSharedLink(pGfxLink); + aGraphic.SetLink(aGfxLink); aGraphic.setOriginURL(aFileName); // Create the page and insert the Graphic. diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 3d998ec94ac5..c462dc2c67ac 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -160,8 +160,7 @@ private: bool ImplIsSwapOut() const { return mbSwapOut;} bool ImplIsDummyContext() const { return mbDummyContext; } - void ImplSetLink( const GfxLink& ); - void ImplSetSharedLink(const std::shared_ptr<GfxLink>& pGfxLink); + void ImplSetLink( const std::shared_ptr<GfxLink>& ); GfxLink ImplGetLink(); bool ImplIsLink() const; diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 04e567e44d5d..1fc7897ac90b 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -569,12 +569,6 @@ void Graphic::SetLink( const GfxLink& rGfxLink ) mxImpGraphic->ImplSetLink( rGfxLink ); } -void Graphic::SetSharedLink(const std::shared_ptr<GfxLink>& pGfxLink) -{ - ImplTestRefCount(); - mxImpGraphic->ImplSetSharedLink(pGfxLink); -} - GfxLink Graphic::GetLink() const { return mxImpGraphic->ImplGetLink(); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 6e837c979e78..2d73357ec43d 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -125,14 +125,6 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic) , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink) , mnPageNumber(rImpGraphic.mnPageNumber) { - if( rImpGraphic.mpGfxLink ) - { - if (rImpGraphic.mpGfxLink->GetType() == GfxLinkType::NativePdf) - mpGfxLink = rImpGraphic.mpGfxLink; - else - mpGfxLink = std::make_shared<GfxLink>(*rImpGraphic.mpGfxLink); - } - if( rImpGraphic.mpAnimation ) { mpAnimation = o3tl::make_unique<Animation>( *rImpGraphic.mpAnimation ); @@ -245,18 +237,9 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic ) mbSwapOut = rImpGraphic.mbSwapOut; mpSwapFile = rImpGraphic.mpSwapFile; - if (rImpGraphic.mpGfxLink) - { - if (rImpGraphic.mpGfxLink->GetType() == GfxLinkType::NativePdf) - mpGfxLink = rImpGraphic.mpGfxLink; - else - { - mpGfxLink.reset(); - - mpGfxLink = std::make_shared<GfxLink>(*rImpGraphic.mpGfxLink); - } - } + mpGfxLink = rImpGraphic.mpGfxLink; + maVectorGraphicData = rImpGraphic.maVectorGraphicData; mpPdfData = rImpGraphic.mpPdfData; } @@ -1384,15 +1367,7 @@ bool ImpGraphic::ImplSwapIn( SvStream* xIStm ) void ImpGraphic::ImplSetLink(const GfxLink& rGfxLink) { - mpGfxLink = std::make_shared<GfxLink>( rGfxLink ); - - if( mpGfxLink->IsNative() ) - mpGfxLink->SwapOut(); -} - -void ImpGraphic::ImplSetSharedLink(const std::shared_ptr<GfxLink>& pGfxLink) -{ - mpGfxLink = pGfxLink; + mpGfxLink = rGfxLink; if (mpGfxLink && mpGfxLink->IsNative()) mpGfxLink->SwapOut(); commit f1552a8bb74a5eb07ad7e675a50f60dec935b9e3 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Thu Mar 28 09:06:53 2019 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Thu Mar 28 09:06:53 2019 +0100 Revert "pdfium: Keep the PDF data in memory, so that we can really share them." This reverts commit 6a96ea6378986ad7a8951dde583ae590edae1a65. diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx index c491f50ef34b..1a1ff0d680cb 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -16,11 +16,6 @@ namespace vcl { -/// Fills the rBitmaps vector with rendered pages. -VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBitmaps, - const size_t nFirstPage = 0, int nPages = 1, - const double fResolutionDPI = 96.); - /// Imports a PDF stream into rGraphic as a GDIMetaFile. VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageIndex, css::uno::Sequence<sal_Int8>& rPdfData, diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 16cb902e2476..ab70a0451d9d 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -63,12 +63,68 @@ size_t generatePreview(SvStream& rStream, std::vector<Bitmap>& rBitmaps, const size_t nFirstPage = 0, int nPages = 1, const double fResolutionDPI = 96.) { + FPDF_LIBRARY_CONFIG aConfig; + aConfig.version = 2; + aConfig.m_pUserFontPaths = nullptr; + aConfig.m_pIsolate = nullptr; + aConfig.m_v8EmbedderSlot = 0; + FPDF_InitLibraryWithConfig(&aConfig); + // Read input into a buffer. SvMemoryStream aInBuffer; rStream.Seek(nPos); aInBuffer.WriteStream(rStream, nSize); - return vcl::RenderPDFBitmaps(aInBuffer.GetData(), aInBuffer.GetSize(), rBitmaps, nFirstPage, nPages, fResolutionDPI); + // Load the buffer using pdfium. + FPDF_DOCUMENT pPdfDocument = FPDF_LoadMemDocument(aInBuffer.GetData(), aInBuffer.GetSize(), /*password=*/nullptr); + if (!pPdfDocument) + return 0; + + const int nPageCount = FPDF_GetPageCount(pPdfDocument); + if (nPages <= 0) + nPages = nPageCount; + const size_t nLastPage = std::min<int>(nPageCount, nFirstPage + nPages) - 1; + for (size_t nPageIndex = nFirstPage; nPageIndex <= nLastPage; ++nPageIndex) + { + // Render next page. + FPDF_PAGE pPdfPage = FPDF_LoadPage(pPdfDocument, nPageIndex); + if (!pPdfPage) + break; + + // Returned unit is points, convert that to pixel. + const size_t nPageWidth = pointToPixel(FPDF_GetPageWidth(pPdfPage), fResolutionDPI); + const size_t nPageHeight = pointToPixel(FPDF_GetPageHeight(pPdfPage), fResolutionDPI); + FPDF_BITMAP pPdfBitmap = FPDFBitmap_Create(nPageWidth, nPageHeight, /*alpha=*/1); + if (!pPdfBitmap) + break; + + const FPDF_DWORD nColor = FPDFPage_HasTransparency(pPdfPage) ? 0x00000000 : 0xFFFFFFFF; + FPDFBitmap_FillRect(pPdfBitmap, 0, 0, nPageWidth, nPageHeight, nColor); + FPDF_RenderPageBitmap(pPdfBitmap, pPdfPage, /*start_x=*/0, /*start_y=*/0, nPageWidth, nPageHeight, /*rotate=*/0, /*flags=*/0); + + // Save the buffer as a bitmap. + Bitmap aBitmap(Size(nPageWidth, nPageHeight), 24); + { + Bitmap::ScopedWriteAccess pWriteAccess(aBitmap); + const auto pPdfBuffer = static_cast<ConstScanline>(FPDFBitmap_GetBuffer(pPdfBitmap)); + const int nStride = FPDFBitmap_GetStride(pPdfBitmap); + for (size_t nRow = 0; nRow < nPageHeight; ++nRow) + { + ConstScanline pPdfLine = pPdfBuffer + (nStride * nRow); + // pdfium byte order is BGRA. + pWriteAccess->CopyScanline(nRow, pPdfLine, ScanlineFormat::N32BitTcBgra, nStride); + } + } + + rBitmaps.emplace_back(std::move(aBitmap)); + FPDFBitmap_Destroy(pPdfBitmap); + FPDF_ClosePage(pPdfPage); + } + + FPDF_CloseDocument(pPdfDocument); + FPDF_DestroyLibrary(); + + return rBitmaps.size(); } /// Decide if PDF data is old enough to be compatible. @@ -155,69 +211,6 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream, namespace vcl { -size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBitmaps, - const size_t nFirstPage, int nPages, - const double fResolutionDPI) -{ - FPDF_LIBRARY_CONFIG aConfig; - aConfig.version = 2; - aConfig.m_pUserFontPaths = nullptr; - aConfig.m_pIsolate = nullptr; - aConfig.m_v8EmbedderSlot = 0; - FPDF_InitLibraryWithConfig(&aConfig); - - // Load the buffer using pdfium. - FPDF_DOCUMENT pPdfDocument = FPDF_LoadMemDocument(pBuffer, nSize, /*password=*/nullptr); - if (!pPdfDocument) - return 0; - - const int nPageCount = FPDF_GetPageCount(pPdfDocument); - if (nPages <= 0) - nPages = nPageCount; - const size_t nLastPage = std::min<int>(nPageCount, nFirstPage + nPages) - 1; - for (size_t nPageIndex = nFirstPage; nPageIndex <= nLastPage; ++nPageIndex) - { - // Render next page. - FPDF_PAGE pPdfPage = FPDF_LoadPage(pPdfDocument, nPageIndex); - if (!pPdfPage) - break; - - // Returned unit is points, convert that to pixel. - const size_t nPageWidth = pointToPixel(FPDF_GetPageWidth(pPdfPage), fResolutionDPI); - const size_t nPageHeight = pointToPixel(FPDF_GetPageHeight(pPdfPage), fResolutionDPI); - FPDF_BITMAP pPdfBitmap = FPDFBitmap_Create(nPageWidth, nPageHeight, /*alpha=*/1); - if (!pPdfBitmap) - break; - - const FPDF_DWORD nColor = FPDFPage_HasTransparency(pPdfPage) ? 0x00000000 : 0xFFFFFFFF; - FPDFBitmap_FillRect(pPdfBitmap, 0, 0, nPageWidth, nPageHeight, nColor); - FPDF_RenderPageBitmap(pPdfBitmap, pPdfPage, /*start_x=*/0, /*start_y=*/0, nPageWidth, nPageHeight, /*rotate=*/0, /*flags=*/0); - - // Save the buffer as a bitmap. - Bitmap aBitmap(Size(nPageWidth, nPageHeight), 24); - { - Bitmap::ScopedWriteAccess pWriteAccess(aBitmap); - const auto pPdfBuffer = static_cast<ConstScanline>(FPDFBitmap_GetBuffer(pPdfBitmap)); - const int nStride = FPDFBitmap_GetStride(pPdfBitmap); - for (size_t nRow = 0; nRow < nPageHeight; ++nRow) - { - ConstScanline pPdfLine = pPdfBuffer + (nStride * nRow); - // pdfium byte order is BGRA. - pWriteAccess->CopyScanline(nRow, pPdfLine, ScanlineFormat::N32BitTcBgra, nStride); - } - } - - rBitmaps.emplace_back(std::move(aBitmap)); - FPDFBitmap_Destroy(pPdfBitmap); - FPDF_ClosePage(pPdfPage); - } - - FPDF_CloseDocument(pPdfDocument); - FPDF_DestroyLibrary(); - - return rBitmaps.size(); -} - bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageIndex, css::uno::Sequence<sal_Int8>& rPdfData, diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 87c2c233a732..6e837c979e78 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -37,7 +37,6 @@ #include <impgraph.hxx> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <vcl/dibtools.hxx> -#include <map> #include <memory> #include <o3tl/make_unique.hxx> #include <vcl/gdimetafiletools.hxx> @@ -1476,7 +1475,6 @@ bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const return bResult; } -static std::map<BitmapChecksum, std::shared_ptr<css::uno::Sequence<sal_Int8>>> sPdfDataCache; void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) { @@ -1625,25 +1623,23 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) else if (nMagic == nPdfMagic) { // Stream in PDF data. - BitmapChecksum nPdfId = 0; - rIStm.ReadUInt64(nPdfId); - - rImpGraphic.mnPageNumber = 0; - rIStm.ReadInt32(rImpGraphic.mnPageNumber); - - auto it = sPdfDataCache.find(nPdfId); - assert(it != sPdfDataCache.end()); - - rImpGraphic.mpPdfData = it->second; - + sal_uInt32 nPdfDataLength = 0; + rIStm.ReadUInt32(nPdfDataLength); Bitmap aBitmap; - rImpGraphic.maEx = aBitmap; - std::vector<Bitmap> aBitmaps; - if (vcl::RenderPDFBitmaps(rImpGraphic.mpPdfData->getConstArray(), rImpGraphic.mpPdfData->getLength(), aBitmaps, rImpGraphic.mnPageNumber, 1) == 1) - rImpGraphic.maEx = aBitmaps[0]; + if (nPdfDataLength && !rIStm.GetError()) + { + if (!rImpGraphic.mpPdfData) + rImpGraphic.mpPdfData.reset(new uno::Sequence<sal_Int8>()); - rImpGraphic.meType = GraphicType::Bitmap; + if (vcl::ImportPDF(rIStm, aBitmap, rImpGraphic.mnPageNumber, + *rImpGraphic.mpPdfData, + rIStm.Tell(), nPdfDataLength)) + { + rImpGraphic.maEx = aBitmap; + rImpGraphic.meType = GraphicType::Bitmap; + } + } } else { @@ -1734,14 +1730,10 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic) } else if (rImpGraphic.hasPdfData()) { - BitmapChecksum nPdfId = vcl_get_checksum(0, rImpGraphic.mpPdfData->getConstArray(), rImpGraphic.mpPdfData->getLength()); - if (sPdfDataCache.find(nPdfId) == sPdfDataCache.end()) - sPdfDataCache.emplace(nPdfId, rImpGraphic.mpPdfData); - // Stream out PDF data. rOStm.WriteUInt32(nPdfMagic); - rOStm.WriteUInt64(nPdfId); - rOStm.WriteInt32(rImpGraphic.mnPageNumber); + rOStm.WriteUInt32(rImpGraphic.mpPdfData->getLength()); + rOStm.WriteBytes(rImpGraphic.mpPdfData->getConstArray(), rImpGraphic.mpPdfData->getLength()); } else if( rImpGraphic.ImplIsAnimated()) { commit cec4b94df735dce507c48bb13dc4e375387ac3b2 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Thu Mar 28 09:06:44 2019 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Thu Mar 28 09:06:44 2019 +0100 Revert "Fix build in !HAVE_FEATURE_PDFIUM case" This reverts commit 77a735be8a2196e890e88662fe73816fa44dd023. diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index f73dc5736fbf..16cb902e2476 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -155,8 +155,6 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream, namespace vcl { -#if HAVE_FEATURE_PDFIUM - size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBitmaps, const size_t nFirstPage, int nPages, const double fResolutionDPI) @@ -220,8 +218,6 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBi return rBitmaps.size(); } -#endif // HAVE_FEATURE_PDFIUM - bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageIndex, css::uno::Sequence<sal_Int8>& rPdfData, commit 0f1488d8e22e1f4a1f2d25773b3eb2bee35e3ba7 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Thu Mar 28 09:06:02 2019 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Thu Mar 28 09:06:02 2019 +0100 Revert "Fix linking error in the !HAVE_FEATURE_PDFIUM case" This reverts commit f961ebd3ea10313c409165f84ff0885fc2b09874. diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 30160c3fa79c..87c2c233a732 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <config_features.h> - #include <sal/config.h> #include <comphelper/processfactory.hxx> @@ -1624,7 +1622,6 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) } } } -#if HAVE_FEATURE_PDFIUM else if (nMagic == nPdfMagic) { // Stream in PDF data. @@ -1648,7 +1645,6 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) rImpGraphic.meType = GraphicType::Bitmap; } -#endif else { rIStm.SetError(nOrigError); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits