vcl/source/gdi/pdfwriter_impl.cxx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
New commits: commit 2ec558395c70db9d493e705566673f7e7c349a7a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Fri Dec 4 18:19:08 2015 +0100 tdf#94739 use GetScanlineSize instead of calculating it We calculate the scanline size wrongly when writing a PDF so the image is not exported correctly. BitmapAccess already has a method to determine the scanline size so use that instead. Change-Id: Icccba8f26c5e0fd4bd4c37bba7c5a7fe8d0094bd (cherry picked from commit 82e0c38e1205a3c8a70234a95ca33ab1400fbe57) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index a04fa0d..7b82e01 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -11420,7 +11420,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) beginCompression(); if( ! bTrueColor || pAccess->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) { - const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U ); + const int nScanLineBytes = pAccess->GetScanlineSize(); for( long i = 0; i < pAccess->Height(); i++ ) { commit 5a3e156f9595cc9490d6ac942a71c824429adea2 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Fri Dec 4 18:15:39 2015 +0100 pdf export: use ScopedBitmapAccess and remove AccessReleaser AccessReleaser does the same job as a ScopedBitmapAccess, but it is a local class in pdf writer - removing it. Change-Id: I3608a80fde8af938de479a9ecf44b134e1be7aa8 (cherry picked from commit 7bda8fbd17e271e8eaf3df2719da7f637465854a) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index cea5b53..a04fa0d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10759,14 +10759,6 @@ void PDFWriterImpl::drawPixel( const Point& rPoint, const Color& rColor ) setFillColor( aOldFillColor ); } -class AccessReleaser -{ - BitmapReadAccess* m_pAccess; -public: - explicit AccessReleaser( BitmapReadAccess* pAccess ) : m_pAccess( pAccess ){} - ~AccessReleaser() { delete m_pAccess; } -}; - bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) { CHECK_RETURN( updateObject( rObject.m_nObject ) ); @@ -10926,8 +10918,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) aDev->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); Bitmap aSample = aDev->GetBitmap( Point( 0, 0 ), rObject.m_aSize ); - BitmapReadAccess* pAccess = aSample.AcquireReadAccess(); - AccessReleaser aReleaser( pAccess ); + Bitmap::ScopedReadAccess pAccess(aSample); Size aSize = aSample.GetSizePixel(); @@ -11241,8 +11232,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) } } - BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess(); - AccessReleaser aReleaser( pAccess ); + Bitmap::ScopedReadAccess pAccess(aBitmap); bool bTrueColor; sal_Int32 nBitsPerComponent; @@ -11422,7 +11412,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) #ifndef DEBUG_DISABLE_PDFCOMPRESSION if( nBitsPerComponent == 1 ) { - writeG4Stream( pAccess ); + writeG4Stream(pAccess.get()); } else #endif
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits