include/svx/xbitmap.hxx | 4 +- include/vcl/dibtools.hxx | 6 +++ lotuswordpro/source/filter/lwpbackgroundstuff.cxx | 8 +--- sc/source/filter/excel/xiescher.cxx | 2 - svx/source/xoutdev/xattrbmp.cxx | 10 ++--- vcl/source/bitmap/BitmapTools.cxx | 44 +++++++++++++++------- vcl/source/gdi/dibtools.cxx | 9 ++++ 7 files changed, 55 insertions(+), 28 deletions(-)
New commits: commit b90e098a354323b635bab3ee8f9c79deb1e734fe Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Feb 14 11:20:32 2018 +0200 use BitmapEx in LwpBackgroundStuff part of making Bitmap an implementation detail of vcl/ Change-Id: I847a2371cd630637b11aed0fad7263809143c706 Reviewed-on: https://gerrit.libreoffice.org/49705 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/xbitmap.hxx b/include/svx/xbitmap.hxx index d5ff0f7eb9e1..e062a0aebc5a 100644 --- a/include/svx/xbitmap.hxx +++ b/include/svx/xbitmap.hxx @@ -43,7 +43,7 @@ private: public: - XOBitmap( const Bitmap& rBitmap ); + XOBitmap( const BitmapEx& rBitmap ); ~XOBitmap(); void Bitmap2Array(); @@ -52,7 +52,7 @@ public: void SetPixelColor( const Color& rColor ) { aPixelColor = rColor; bGraphicDirty = true; } void SetBackgroundColor( const Color& rColor ) { aBckgrColor = rColor; bGraphicDirty = true; } - Bitmap GetBitmap() const; + BitmapEx GetBitmap() const; const Color& GetBackgroundColor() const { return aBckgrColor; } }; diff --git a/include/vcl/dibtools.hxx b/include/vcl/dibtools.hxx index 75618ad609d7..f56ee96bd4e4 100644 --- a/include/vcl/dibtools.hxx +++ b/include/vcl/dibtools.hxx @@ -60,6 +60,12 @@ bool VCL_DLLPUBLIC WriteDIB( // WriteDIB(rBitmap, rOStm, false, true); bool bCompressed, bool bFileHeader); +bool VCL_DLLPUBLIC WriteDIB( // WriteDIB(rBitmap, rOStm, false, true); + const BitmapEx& rSource, + SvStream& rOStm, + bool bCompressed, + bool bFileHeader); + bool VCL_DLLPUBLIC WriteDIBBitmapEx( const BitmapEx& rSource, SvStream& rOStm); diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx index 90a77cb8eb19..7ee17a64fdd8 100644 --- a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx +++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx @@ -65,7 +65,7 @@ #include <tools/stream.hxx> #include <vcl/dibtools.hxx> -#include <vcl/bitmapaccess.hxx> +#include <vcl/BitmapTools.hxx> #include <svx/xbitmap.hxx> void LwpBackgroundStuff::Read(LwpObjectStream* pStrm) @@ -114,11 +114,7 @@ XFBGImage* LwpBackgroundStuff::GetFillPattern() GetPattern(m_nID, aPttnArray); // create bitmap object from the pattern array - Bitmap aBmp( Size(8, 8), 1 ); - BitmapWriteAccess* pWA = aBmp.AcquireWriteAccess(); - sal_uInt8* pBuf = pWA->GetBuffer(); - memcpy(pBuf, aPttnArray, 32); - Bitmap::ReleaseAccess(pWA); + BitmapEx aBmp = vcl::bitmap::CreateFromData( aPttnArray, 8, 8, 8, 1 ); // create XOBitmap object from bitmap object XOBitmap aXOBitmap( aBmp ); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 63284f9076d2..5d03a6ecaf62 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -720,7 +720,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa aXOBitmap.SetPixelColor( aPattColor ); aXOBitmap.SetBackgroundColor( aBackColor ); aXOBitmap.Array2Bitmap(); - aBitmap = aXOBitmap.GetBitmap(); + aBitmap = aXOBitmap.GetBitmap().GetBitmapRef(); rSdrObj.SetMergedItem(XFillStyleItem(drawing::FillStyle_BITMAP)); rSdrObj.SetMergedItem(XFillBitmapItem(EMPTY_OUSTRING, Graphic(aBitmap))); diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index fad22b1c546d..6bb58e9707bb 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -44,7 +44,7 @@ using namespace ::com::sun::star; -XOBitmap::XOBitmap( const Bitmap& rBmp ) : +XOBitmap::XOBitmap( const BitmapEx& rBmp ) : xGraphicObject (new GraphicObject(rBmp)), bGraphicDirty ( false ) { @@ -54,9 +54,9 @@ XOBitmap::~XOBitmap() { } -Bitmap XOBitmap::GetBitmap() const +BitmapEx XOBitmap::GetBitmap() const { - return GetGraphicObject().GetGraphic().GetBitmap(); + return GetGraphicObject().GetGraphic().GetBitmapEx(); } const GraphicObject& XOBitmap::GetGraphicObject() const @@ -71,14 +71,14 @@ void XOBitmap::Bitmap2Array() { ScopedVclPtrInstance< VirtualDevice > pVDev; bool bPixelColor = false; - const Bitmap aBitmap( GetBitmap() ); + const BitmapEx aBitmap( GetBitmap() ); const sal_Int32 nLines = 8; // type dependent if( !pPixelArray ) pPixelArray.reset( new sal_uInt16[ nLines * nLines ] ); pVDev->SetOutputSizePixel( aBitmap.GetSizePixel() ); - pVDev->DrawBitmap( Point(), aBitmap ); + pVDev->DrawBitmapEx( Point(), aBitmap ); aPixelColor = aBckgrColor = pVDev->GetPixel( Point() ); // create array and determine foreground and background color diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 4570be72e436..87c6b64fb56a 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -114,7 +114,7 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount ) { assert(nStride >= nWidth); - assert( nBitCount == 24 || nBitCount == 32); + assert( nBitCount == 1 || nBitCount == 24 || nBitCount == 32); Bitmap aBmp( Size( nWidth, nHeight ), nBitCount ); Bitmap::ScopedWriteAccess pWrite(aBmp); @@ -128,26 +128,42 @@ BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHe pAlphaMask.reset( new AlphaMask( Size(nWidth, nHeight) ) ); xMaskAcc = AlphaMask::ScopedWriteAccess(*pAlphaMask); } - for( long y = 0; y < nHeight; ++y ) + if (nBitCount == 1) { - sal_uInt8 const *p = pData + y * nStride; - Scanline pScanline = pWrite->GetScanline(y); - for (long x = 0; x < nWidth; ++x) + for( long y = 0; y < nHeight; ++y ) { - BitmapColor col(p[0], p[1], p[2]); - pWrite->SetPixelOnData(pScanline, x, col); - p += nBitCount/8; + sal_uInt8 const *p = pData + y * nStride; + Scanline pScanline = pWrite->GetScanline(y); + for (long x = 0; x < nWidth; ++x) + { + pWrite->SetPixelOnData(pScanline, x, BitmapColor(*p)); + ++p; + } } - if (nBitCount == 32) + } + else + { + for( long y = 0; y < nHeight; ++y ) { - p = pData + y * nStride + 3; - Scanline pMaskScanLine = xMaskAcc->GetScanline(y); + sal_uInt8 const *p = pData + y * nStride; + Scanline pScanline = pWrite->GetScanline(y); for (long x = 0; x < nWidth; ++x) { - xMaskAcc->SetPixelOnData(pMaskScanLine, x, BitmapColor(*p)); - p += 4; + BitmapColor col(p[0], p[1], p[2]); + pWrite->SetPixelOnData(pScanline, x, col); + p += nBitCount/8; } - } + if (nBitCount == 32) + { + p = pData + y * nStride + 3; + Scanline pMaskScanLine = xMaskAcc->GetScanline(y); + for (long x = 0; x < nWidth; ++x) + { + xMaskAcc->SetPixelOnData(pMaskScanLine, x, BitmapColor(*p)); + p += 4; + } + } + } } if (nBitCount == 32) return BitmapEx(aBmp, *pAlphaMask); diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 325f1e68d670..61acb72dfcb2 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -1831,6 +1831,15 @@ bool WriteDIB( return ImplWriteDIB(rSource, rOStm, bCompressed, bFileHeader); } +bool WriteDIB( + const BitmapEx& rSource, + SvStream& rOStm, + bool bCompressed, + bool bFileHeader) +{ + return ImplWriteDIB(rSource.GetBitmapRef(), rOStm, bCompressed, bFileHeader); +} + bool WriteDIBBitmapEx( const BitmapEx& rSource, SvStream& rOStm) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits