summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-15 13:27:30 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-02-15 18:34:09 +0100
commit380da094b0ad765b80c353a6b6d2a1aa6a003f6a (patch)
treef6920ffb3955b66cbbf502aa2faf12be8374f43f /lotuswordpro
parentcf385d9cbbd7e64dd981595e07cac7f3e05519f8 (diff)
ofz#6372 fix bitmap decoding of pattern in LwpBackgroundStuff
after commit b90e098a354323b635bab3ee8f9c79deb1e734fe use BitmapEx in LwpBackgroundStuff <caolan> maybe the lotuswordpro original stride is really 4 after all (as a common stride), with the first byte on each line containing the 8bits for each row The original code in GetPattern() looked pretty dodgy since it was copying 32-bytes into an 8 byte buffer. Assume that the reversing part is right, and that the format is really a 1bit packed 8x8 image. Also fix the decoding of such a image in CreateFromData to assume packed format, which is more predictable. Also fix the bug in createDefaultCross_3x3 which changing the assert revealed. Change-Id: I7196ae601429bbe0f842399df61c8b858e022d3e Reviewed-on: https://gerrit.libreoffice.org/49808 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundstuff.cxx10
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundstuff.hxx2
2 files changed, 6 insertions, 6 deletions
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
index 7ee17a64fdd8..6aecf25ddcaf 100644
--- a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
@@ -76,7 +76,7 @@ void LwpBackgroundStuff::Read(LwpObjectStream* pStrm)
pStrm->SkipExtra();
}
-void LwpBackgroundStuff::GetPattern(sal_uInt16 btPttnIndex, sal_uInt8* pPttnArray)
+void LwpBackgroundStuff::GetPattern(sal_uInt16 btPttnIndex, sal_uInt8 (&pPttnArray)[8])
{
if (btPttnIndex > 71)
{
@@ -85,9 +85,9 @@ void LwpBackgroundStuff::GetPattern(sal_uInt16 btPttnIndex, sal_uInt8* pPttnArra
}
assert((2 < btPttnIndex) && (btPttnIndex < 72));
const sal_uInt8* pTempArray = s_pLwpPatternTab[btPttnIndex];
- for(sal_uInt8 i = 0; i < 32; i++)
+ for(sal_uInt8 i = 0; i < 8; i++)
{
- pPttnArray[i] = (i%4 == 0) ? pTempArray[7-i/4] : 0;
+ pPttnArray[i] = pTempArray[7-i];
}
}
@@ -110,11 +110,11 @@ XFBGImage* LwpBackgroundStuff::GetFillPattern()
}
// get pattern array from pattern table
- sal_uInt8 aPttnArray[32];
+ sal_uInt8 aPttnArray[8];
GetPattern(m_nID, aPttnArray);
// create bitmap object from the pattern array
- BitmapEx aBmp = vcl::bitmap::CreateFromData( aPttnArray, 8, 8, 8, 1 );
+ BitmapEx aBmp = vcl::bitmap::CreateFromData( aPttnArray, 8, 8, 1, 1 );
// create XOBitmap object from bitmap object
XOBitmap aXOBitmap( aBmp );
diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.hxx b/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
index 6f3ab8a1ca16..ee2c4af4d5ec 100644
--- a/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.hxx
@@ -145,7 +145,7 @@ public:
}
private:
- static void GetPattern(sal_uInt16 btPttnIndex, sal_uInt8* pPttnArray);
+ static void GetPattern(sal_uInt16 btPttnIndex, sal_uInt8 (&pPttnArray)[8]);
public:
void Read(LwpObjectStream *pStrm);