diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-08 11:25:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-08 12:58:51 +0200 |
commit | 7707cba0bd3f1d544ead634282f8d3415af0cd5e (patch) | |
tree | ac931af938a4fad99f8d96c479451b623ea4b037 | |
parent | f7e4a52411255b61e8fcc4172e67c9f86cf25e36 (diff) |
use BitmapEx in ImpSdrPdfImport::ImportImage
Change-Id: I80e197ffcda4ebc5d50e611b7a4a5c3fd84fc839
Reviewed-on: https://gerrit.libreoffice.org/75201
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/bitmapex.hxx | 8 | ||||
-rw-r--r-- | include/vcl/dibtools.hxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdpdf.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/dibtools.cxx | 4 |
5 files changed, 20 insertions, 4 deletions
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index 71da7cb45dc8..478b9fdefea9 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -22,6 +22,7 @@ #include <vcl/dllapi.h> #include <vcl/alpha.hxx> +#include <vcl/Scanline.hxx> #include <tools/color.hxx> #include <sal/types.h> @@ -47,6 +48,7 @@ public: explicit BitmapEx( const OUString& rIconName ); BitmapEx( const BitmapEx& rBitmapEx ); BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ); + BitmapEx( Size aSize, sal_uInt16 nBitCount ); explicit BitmapEx( const Bitmap& rBmp ); BitmapEx( const Bitmap& rBmp, const Bitmap& rMask ); BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ); @@ -467,6 +469,12 @@ public: private: friend class ImpGraphic; friend bool VCL_DLLPUBLIC WriteDIBBitmapEx(const BitmapEx& rSource, SvStream& rOStm); + friend void ReadRawDIB(); + friend bool VCL_DLLPUBLIC ReadRawDIB(BitmapEx& rTarget, const unsigned char* pBuf, + const ScanlineFormat nFormat, + const int nHeight, + const int nStride); + void loadFromIconTheme( const OUString& rIconName ); Bitmap maBitmap; diff --git a/include/vcl/dibtools.hxx b/include/vcl/dibtools.hxx index c5fa662ebb73..6064491f8ec3 100644 --- a/include/vcl/dibtools.hxx +++ b/include/vcl/dibtools.hxx @@ -55,7 +55,7 @@ bool VCL_DLLPUBLIC ReadDIBV5( SvStream& rIStm); bool VCL_DLLPUBLIC ReadRawDIB( - Bitmap& rTarget, + BitmapEx& rTarget, const unsigned char* pBuf, const ScanlineFormat nFormat, const int nHeight, diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 687c3e260341..552575442039 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -992,7 +992,7 @@ void ImpSdrPdfImport::ImportImage(FPDF_PAGEOBJECT pPageObject, int /*nPageObject const int nWidth = FPDFBitmap_GetWidth(bitmap.get()); const int nHeight = FPDFBitmap_GetHeight(bitmap.get()); const int nStride = FPDFBitmap_GetStride(bitmap.get()); - Bitmap aBitmap(Size(nWidth, nHeight), 24); + BitmapEx aBitmap(Size(nWidth, nHeight), 24); switch (format) { diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 3faaf3fd96e1..4bfbfeb5a2ff 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -85,6 +85,14 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ) CopyPixel( aDestRect, aSrcRect, &rBitmapEx ); } +BitmapEx::BitmapEx( Size aSize, sal_uInt16 nBitCount ) + : meTransparent(TransparentType::NONE) + , mbAlpha(false) +{ + maBitmap = Bitmap( aSize, nBitCount ); + SetSizePixel(aSize); +} + BitmapEx::BitmapEx( const OUString& rIconName ) : meTransparent(TransparentType::NONE) , mbAlpha(false) diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index c8f64318f0fd..965a403a0d7d 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -1839,13 +1839,13 @@ bool ReadDIBV5( } bool ReadRawDIB( - Bitmap& rTarget, + BitmapEx& rTarget, const unsigned char* pBuf, const ScanlineFormat nFormat, const int nHeight, const int nStride) { - BitmapScopedWriteAccess pWriteAccess(rTarget.AcquireWriteAccess(), rTarget); + BitmapScopedWriteAccess pWriteAccess(rTarget.maBitmap.AcquireWriteAccess(), rTarget.maBitmap); for (int nRow = 0; nRow < nHeight; ++nRow) { pWriteAccess->CopyScanline(nRow, pBuf + (nStride * nRow), nFormat, nStride); |