summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-12 13:27:21 +0000
committerAndras Timar <andras.timar@collabora.com>2015-01-12 15:20:05 +0100
commit7440dd32b7327198e49d3922379780ba5399ab1a (patch)
treecd825d0b68487ceab29e9dd6058406ddc2e9e455
parent74fb0cb74bc62b5d652f0fb10f8dc3b4795c6cd3 (diff)
Resolves: fdo#87015 image missing from doc
regression from commit e0cce521f1ad0cc384d30ce2f1077ea229fffe62 Author: Armin Le Grand <alg@apache.org> AuthorDate: Thu Jan 10 16:28:40 2013 +0000 Commit: Caolán McNamara <caolanm@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 (cherry picked from commit 470fcca594ba4f6bf473d4d44b415c2ba151b0d9) Conflicts: vcl/source/gdi/dibtools.cxx Change-Id: Iec354f1fb585f0803b9df472bc9ec9e103aa5847
-rw-r--r--filter/source/msfilter/mstoolbar.cxx2
-rw-r--r--include/vcl/dibtools.hxx3
-rw-r--r--vcl/source/gdi/dibtools.cxx39
3 files changed, 35 insertions, 9 deletions
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index c4a6c7f13fc7..f909e6b168fd 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -713,7 +713,7 @@ bool TBCBitMap::Read( SvStream& rS)
nOffSet = rS.Tell();
rS >> cbDIB;
// cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
- return ReadDIB(mBitMap, rS, false);
+ return ReadDIB(mBitMap, rS, false, true);
}
void TBCBitMap::Print( FILE* fp )
diff --git a/include/vcl/dibtools.hxx b/include/vcl/dibtools.hxx
index b880147260e0..113d821c82ff 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 077f0b00a99b..87c42b9cc2e9 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 >> rHeader.nPlanes;
rIStm >> rHeader.nBitCount;
}
+ else if ( bMSOFormat && rHeader.nSize == DIBINFOHEADERSIZE )
+ {
+ sal_Int16 nTmp16(0);
+ rIStm >> nTmp16;
+ rHeader.nWidth = nTmp16;
+ rIStm >> nTmp16;
+ rHeader.nHeight = nTmp16;
+ sal_uInt8 nTmp8(0);
+ rIStm >> nTmp8;
+ rHeader.nPlanes = nTmp8;
+ rIStm >> nTmp8;
+ rHeader.nBitCount = nTmp8;
+ rIStm >> nTmp16;
+ rHeader.nSizeImage = nTmp16;
+ rIStm >> nTmp16;
+ rHeader.nCompression = nTmp16;
+ if ( !rHeader.nSizeImage ) // uncompressed?
+ rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
+ rIStm >> rHeader.nXPelsPerMeter;
+ rIStm >> rHeader.nYPelsPerMeter;
+ rIStm >> rHeader.nColsUsed;
+ rIStm >> rHeader.nColsImportant;
+ }
else
{
// BITMAPCOREHEADER, BITMAPV5HEADER or unknown. Read as far as possible
@@ -617,14 +640,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.
@@ -1357,7 +1380,8 @@ bool ImplReadDIB(
Bitmap& rTarget, Bitmap*
pTargetAlpha,
SvStream& rIStm,
- bool bFileHeader)
+ bool bFileHeader,
+ bool bMSOFormat=false)
{
const sal_uInt16 nOldFormat(rIStm.GetNumberFormatInt());
const sal_uLong nOldPos(rIStm.Tell());
@@ -1375,7 +1399,7 @@ bool ImplReadDIB(
}
else
{
- bRet = ImplReadDIBBody(rIStm, rTarget, 0, nOffset);
+ bRet = ImplReadDIBBody(rIStm, rTarget, 0, nOffset, bMSOFormat);
}
if(!bRet)
@@ -1465,9 +1489,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(