svx/source/inc/svdpdf.hxx | 1 - svx/source/svdraw/svdpdf.cxx | 38 +------------------------------------- vcl/source/pdf/PDFiumLibrary.cxx | 8 ++++++++ 3 files changed, 9 insertions(+), 38 deletions(-)
New commits: commit 38bf7e08d34f906ac85352daea0b657ba60f5175 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Oct 17 17:08:05 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 26 12:07:02 2025 +0100 use createBitmapFromBuffer to get transparency merge the relatively new 8bit grayscale support to that. And drop the thing that doesn't honour 32bit transparency. Change-Id: I61f4544be9573a4d8d4bae056b7866f1310b8ee0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192584 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192986 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 40b2bf7e25f5..65e108e9fd58 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -1941,13 +1941,6 @@ void ImpSdrPdfImport::MapScaling() mnMapScalingOfs = nCount; } -static Bitmap createBitmap(const Size& rSize, bool bGrayScale) -{ - if (bGrayScale) - return Bitmap(rSize, vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256)); - return Bitmap(rSize, vcl::PixelFormat::N24_BPP); -} - void ImpSdrPdfImport::ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject, int /*nPageObjectIndex*/) { @@ -1965,33 +1958,6 @@ void ImpSdrPdfImport::ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> co return; } - const unsigned char* pBuf = bitmap->getBuffer(); - const int nWidth = bitmap->getWidth(); - const int nHeight = bitmap->getHeight(); - const int nStride = bitmap->getStride(); - Bitmap aBitmap(createBitmap(Size(nWidth, nHeight), format == vcl::pdf::PDFBitmapType::Gray)); - - switch (format) - { - case vcl::pdf::PDFBitmapType::Gray: - ReadRawDIB(aBitmap, pBuf, ScanlineFormat::N8BitPal, nHeight, nStride); - break; - case vcl::pdf::PDFBitmapType::BGR: - ReadRawDIB(aBitmap, pBuf, ScanlineFormat::N24BitTcBgr, nHeight, nStride); - break; - case vcl::pdf::PDFBitmapType::BGRx: - ReadRawDIB(aBitmap, pBuf, ScanlineFormat::N32BitTcBgra, nHeight, nStride); - break; - case vcl::pdf::PDFBitmapType::BGRA: - ReadRawDIB(aBitmap, pBuf, ScanlineFormat::N32BitTcBgra, nHeight, nStride); - break; - default: - SAL_WARN("sd.filter", "Got IMAGE width: " << nWidth << ", height: " << nHeight - << ", stride: " << nStride - << ", format: " << static_cast<int>(format)); - break; - } - basegfx::B2DRectangle aBounds = pPageObject->getBounds(); float left = aBounds.getMinX(); // Upside down. @@ -2003,6 +1969,7 @@ void ImpSdrPdfImport::ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> co aRect.AdjustRight(1); aRect.AdjustBottom(1); + Bitmap aBitmap = bitmap->createBitmapFromBuffer(); rtl::Reference<SdrGrafObj> pGraf = new SdrGrafObj(*mpModel, Graphic(aBitmap), aRect); // This action is not creating line and fill, set directly, do not use SetAttributes(..) diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 4b159141764a..f1677461f17b 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -1517,6 +1517,14 @@ Bitmap PDFiumBitmapImpl::createBitmapFromBuffer() switch (eFormat) { + case vcl::pdf::PDFBitmapType::Gray: + { + aBitmap = Bitmap(Size(nWidth, nHeight), vcl::PixelFormat::N8_BPP, + &Bitmap::GetGreyPalette(256)); + ReadRawDIB(aBitmap, getBuffer(), ScanlineFormat::N8BitPal, nHeight, nStride); + } + break; + case vcl::pdf::PDFBitmapType::BGR: { aBitmap = Bitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP); commit 6ac9de3480f768b420817ab37ad9f0c5023f16d1 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Oct 17 11:20:12 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 26 12:06:55 2025 +0100 maOldLineColor is unused Change-Id: I808086b026d9392e4012eb7c394f7c1941d97b8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192579 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192985 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/svx/source/inc/svdpdf.hxx b/svx/source/inc/svdpdf.hxx index 0209b358e8a8..f215c1f05938 100644 --- a/svx/source/inc/svdpdf.hxx +++ b/svx/source/inc/svdpdf.hxx @@ -104,7 +104,6 @@ class ImpSdrPdfImport final std::unique_ptr<SfxItemSet> mpTextAttr; SdrModel* mpModel; SdrLayerID mnLayer; - Color maOldLineColor; sal_Int32 mnLineWidth; static constexpr css::drawing::LineCap gaLineCap = css::drawing::LineCap_BUTT; XDash maDash; diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 9f3811a91473..40b2bf7e25f5 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -126,7 +126,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools: mpVD->EnableOutput(false); mpVD->SetLineColor(); mpVD->SetFillColor(); - maOldLineColor.SetRed(mpVD->GetLineColor().GetRed() + 1); // Get TextBounds relative to baseline vcl::Font aFnt = mpVD->GetFont(); @@ -520,8 +519,6 @@ void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr) mpLineAttr->Put(XLineWidthItem(0)); } - maOldLineColor = mpVD->GetLineColor(); - if (mpVD->IsLineColor()) { mpLineAttr->Put(XLineStyleItem(drawing::LineStyle_SOLID)); //TODO support dashed lines.
