Kaydet (Commit) 7bda8fbd authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

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
üst 6f9bb9bd
...@@ -10758,14 +10758,6 @@ void PDFWriterImpl::drawPixel( const Point& rPoint, const Color& rColor ) ...@@ -10758,14 +10758,6 @@ void PDFWriterImpl::drawPixel( const Point& rPoint, const Color& rColor )
setFillColor( aOldFillColor ); setFillColor( aOldFillColor );
} }
class AccessReleaser
{
BitmapReadAccess* m_pAccess;
public:
explicit AccessReleaser( BitmapReadAccess* pAccess ) : m_pAccess( pAccess ){}
~AccessReleaser() { delete m_pAccess; }
};
bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
{ {
CHECK_RETURN( updateObject( rObject.m_nObject ) ); CHECK_RETURN( updateObject( rObject.m_nObject ) );
...@@ -10925,8 +10917,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) ...@@ -10925,8 +10917,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject )
aDev->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); aDev->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient );
Bitmap aSample = aDev->GetBitmap( Point( 0, 0 ), rObject.m_aSize ); Bitmap aSample = aDev->GetBitmap( Point( 0, 0 ), rObject.m_aSize );
BitmapReadAccess* pAccess = aSample.AcquireReadAccess(); Bitmap::ScopedReadAccess pAccess(aSample);
AccessReleaser aReleaser( pAccess );
Size aSize = aSample.GetSizePixel(); Size aSize = aSample.GetSizePixel();
...@@ -11240,8 +11231,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) ...@@ -11240,8 +11231,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
} }
} }
BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess(); Bitmap::ScopedReadAccess pAccess(aBitmap);
AccessReleaser aReleaser( pAccess );
bool bTrueColor; bool bTrueColor;
sal_Int32 nBitsPerComponent; sal_Int32 nBitsPerComponent;
...@@ -11421,7 +11411,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) ...@@ -11421,7 +11411,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
#ifndef DEBUG_DISABLE_PDFCOMPRESSION #ifndef DEBUG_DISABLE_PDFCOMPRESSION
if( nBitsPerComponent == 1 ) if( nBitsPerComponent == 1 )
{ {
writeG4Stream( pAccess ); writeG4Stream(pAccess.get());
} }
else else
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment