summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-14 11:20:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-14 14:37:40 +0100
commitb90e098a354323b635bab3ee8f9c79deb1e734fe (patch)
tree7d5636a991b8553995e57e0e616e4c0dbea72b4b /vcl
parent95fab7cbf2f0576d0f728bed8898b7ff769d90e6 (diff)
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 <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/bitmap/BitmapTools.cxx44
-rw-r--r--vcl/source/gdi/dibtools.cxx9
2 files changed, 39 insertions, 14 deletions
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)