diff options
-rw-r--r-- | include/vcl/BitmapTools.hxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpbackgroundstuff.cxx | 10 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpbackgroundstuff.hxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrprimitivetools.cxx | 2 | ||||
-rw-r--r-- | vcl/source/bitmap/BitmapTools.cxx | 10 |
5 files changed, 13 insertions, 13 deletions
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx index 4caafb3545e4..cf790e85be14 100644 --- a/include/vcl/BitmapTools.hxx +++ b/include/vcl/BitmapTools.hxx @@ -64,7 +64,7 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, @param pData The block of data to copy @param nStride - The number of bytes in a scanline, must >= width + The number of bytes in a scanline, must be >= (width * nBitCount / 8) */ BitmapEx VCL_DLLPUBLIC CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount ); 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); diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index 6b8a61ea4b01..8eecbeee0715 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -53,7 +53,7 @@ namespace drawinglayer r, g, b, 0, r, g, b, 0, r, g, b, 0, 0, 0, 0, a, r, g, b, 0, 0, 0, 0, a }; - BitmapEx aBitmap = vcl::bitmap::CreateFromData(cross, 3, 3, 3, 32); + BitmapEx aBitmap = vcl::bitmap::CreateFromData(cross, 3, 3, 12, 32); // create and exchange at aRetVal delete aRetVal.set(new BitmapEx(aBitmap)); diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index ee0aef4f1f67..a171fd848a39 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -112,11 +112,11 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, @param pData The block of data to copy @param nStride - The number of bytes in a scanline, must >= width + The number of bytes in a scanline, must >= (width * nBitCount / 8) */ BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount ) { - assert(nStride >= nWidth); + assert(nStride >= (nWidth * nBitCount / 8)); assert( nBitCount == 1 || nBitCount == 24 || nBitCount == 32); Bitmap aBmp( Size( nWidth, nHeight ), nBitCount ); @@ -135,12 +135,12 @@ BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHe { for( long y = 0; y < nHeight; ++y ) { - 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; + sal_uInt8 const *p = pData + y * nStride / 8; + int bitIndex = (y * nStride) % 8; + pWrite->SetPixelOnData(pScanline, x, BitmapColor((*p >> bitIndex) & 1)); } } } |