[Libreoffice-commits] core.git: filter/source include/vcl vcl/source
Caolán McNamara
caolanm at redhat.com
Mon Jan 12 05:29:36 PST 2015
filter/source/msfilter/mstoolbar.cxx | 2 -
include/vcl/dibtools.hxx | 3 +-
vcl/source/gdi/dibtools.cxx | 39 ++++++++++++++++++++++++++++-------
3 files changed, 35 insertions(+), 9 deletions(-)
New commits:
commit 470fcca594ba4f6bf473d4d44b415c2ba151b0d9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jan 12 13:27:21 2015 +0000
Resolves: fdo#87015 image missing from doc
regression from
commit e0cce521f1ad0cc384d30ce2f1077ea229fffe62
Author: Armin Le Grand <alg at apache.org>
AuthorDate: Thu Jan 10 16:28:40 2013 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jun 13 14:50:46 2013 +0100
Resolves: #i121504# Support for alpha channel in clipboard for all systems
(cherry picked from commit ef3931ff410117e1237b3bef7bc090e8b83b9519)
which blindly just bulldozed out the bMSOFormat branch
Change-Id: Iec354f1fb585f0803b9df472bc9ec9e103aa5847
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 1816304..6f2f042 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -724,7 +724,7 @@ bool TBCBitMap::Read( SvStream& rS)
nOffSet = rS.Tell();
rS.ReadInt32( cbDIB );
// cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
- return ReadDIB(mBitMap, rS, false);
+ return ReadDIB(mBitMap, rS, false, true);
}
#if OSL_DEBUG_LEVEL > 1
diff --git a/include/vcl/dibtools.hxx b/include/vcl/dibtools.hxx
index 6091f6e..a43764f 100644
--- a/include/vcl/dibtools.hxx
+++ b/include/vcl/dibtools.hxx
@@ -36,7 +36,8 @@ class Bitmap;
bool VCL_DLLPUBLIC ReadDIB( // ReadDIB(rBitmap, rIStm, true);
Bitmap& rTarget,
SvStream& rIStm,
- bool bFileHeader);
+ bool bFileHeader,
+ bool bMSOFormat=false);
bool VCL_DLLPUBLIC ReadDIBBitmapEx(
BitmapEx& rTarget,
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 3f940af..21b9632 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -166,7 +166,7 @@ namespace
}
}
-bool ImplReadDIBInfoHeader(SvStream& rIStm, DIBV5Header& rHeader, bool& bTopDown)
+bool ImplReadDIBInfoHeader(SvStream& rIStm, DIBV5Header& rHeader, bool& bTopDown, bool bMSOFormat)
{
// BITMAPINFOHEADER or BITMAPCOREHEADER or BITMAPV5HEADER
const sal_Size aStartPos(rIStm.Tell());
@@ -182,6 +182,29 @@ bool ImplReadDIBInfoHeader(SvStream& rIStm, DIBV5Header& rHeader, bool& bTopDown
rIStm.ReadUInt16( rHeader.nPlanes );
rIStm.ReadUInt16( rHeader.nBitCount );
}
+ else if ( bMSOFormat && rHeader.nSize == DIBINFOHEADERSIZE )
+ {
+ sal_Int16 nTmp16(0);
+ rIStm.ReadInt16(nTmp16);
+ rHeader.nWidth = nTmp16;
+ rIStm.ReadInt16(nTmp16);
+ rHeader.nHeight = nTmp16;
+ sal_uInt8 nTmp8(0);
+ rIStm.ReadUChar(nTmp8);
+ rHeader.nPlanes = nTmp8;
+ rIStm.ReadUChar(nTmp8);
+ rHeader.nBitCount = nTmp8;
+ rIStm.ReadInt16(nTmp16);
+ rHeader.nSizeImage = nTmp16;
+ rIStm.ReadInt16(nTmp16);
+ rHeader.nCompression = nTmp16;
+ if ( !rHeader.nSizeImage ) // uncompressed?
+ rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
+ rIStm.ReadInt32( rHeader.nXPelsPerMeter );
+ rIStm.ReadInt32( rHeader.nYPelsPerMeter );
+ rIStm.ReadUInt32( rHeader.nColsUsed );
+ rIStm.ReadUInt32( rHeader.nColsImportant );
+ }
else
{
// BITMAPCOREHEADER, BITMAPV5HEADER or unknown. Read as far as possible
@@ -679,14 +702,14 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
return( rIStm.GetError() == 0UL );
}
-bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLong nOffset )
+bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLong nOffset, bool bMSOFormat = false )
{
DIBV5Header aHeader;
const sal_uLong nStmPos = rIStm.Tell();
bool bRet(false);
bool bTopDown(false);
- if(ImplReadDIBInfoHeader(rIStm, aHeader, bTopDown) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount)
+ if(ImplReadDIBInfoHeader(rIStm, aHeader, bTopDown, bMSOFormat) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount)
{
// In case ImplReadDIB() didn't call ImplReadDIBFileHeader() before
// this method, nOffset is 0, that's OK.
@@ -1417,7 +1440,8 @@ bool ImplReadDIB(
Bitmap& rTarget, Bitmap*
pTargetAlpha,
SvStream& rIStm,
- bool bFileHeader)
+ bool bFileHeader,
+ bool bMSOFormat=false)
{
const SvStreamEndian nOldFormat(rIStm.GetEndian());
const sal_uLong nOldPos(rIStm.Tell());
@@ -1435,7 +1459,7 @@ bool ImplReadDIB(
}
else
{
- bRet = ImplReadDIBBody(rIStm, rTarget, 0, nOffset);
+ bRet = ImplReadDIBBody(rIStm, rTarget, 0, nOffset, bMSOFormat);
}
if(!bRet)
@@ -1523,9 +1547,10 @@ bool ImplWriteDIB(
bool ReadDIB(
Bitmap& rTarget,
SvStream& rIStm,
- bool bFileHeader)
+ bool bFileHeader,
+ bool bMSOFormat)
{
- return ImplReadDIB(rTarget, 0, rIStm, bFileHeader);
+ return ImplReadDIB(rTarget, 0, rIStm, bFileHeader, bMSOFormat);
}
bool ReadDIBBitmapEx(
More information about the Libreoffice-commits
mailing list