summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-10 09:31:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-10 09:31:27 +0000
commit3cd6485ee95ed2b2c4cf8cd7b45a573a0aced175 (patch)
tree6c0ca305d0bf242c1687ccc23b2068c634aae77a /vcl
parentb3bddf8b75226326a39f92f8fcb1745569b86caa (diff)
BitmapWriteAccess* -> Bitmap::ScopedWriteAccess
Change-Id: I5b3980d8eecc61a6f63aa64a1b05c30afa2f57f7
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pngread.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 1d4a6c343eae..8b006751f613 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -76,7 +76,7 @@ private:
std::vector<sal_uInt8>::iterator maDataIter;
std::unique_ptr<Bitmap> mpBmp;
- BitmapWriteAccess* mpAcc;
+ Bitmap::ScopedWriteAccess mpAcc;
std::unique_ptr<Bitmap> mpMaskBmp;
std::unique_ptr<AlphaMask> mpAlphaMask;
BitmapWriteAccess* mpMaskAcc;
@@ -167,7 +167,6 @@ public:
PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
: mrPNGStream( rPNGStream ),
- mpAcc ( nullptr ),
mpMaskAcc ( nullptr ),
mpInflateInBuf ( nullptr ),
mpScanPrior ( nullptr ),
@@ -419,11 +418,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint )
}
// release write access of the bitmaps
- if ( mpAcc )
- {
- Bitmap::ReleaseAccess( mpAcc );
- mpAcc = nullptr;
- }
+ mpAcc.reset();
if ( mpMaskAcc )
{
@@ -662,7 +657,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint )
return false;
mpBmp = o3tl::make_unique<Bitmap>( maTargetSize, mnTargetDepth );
- mpAcc = mpBmp->AcquireWriteAccess();
+ mpAcc = Bitmap::ScopedWriteAccess(*mpBmp);
if( !mpAcc )
return false;
@@ -1120,9 +1115,9 @@ void PNGReaderImpl::ImplApplyFilter()
namespace
{
- void SanitizePaletteIndexes(sal_uInt8* pEntries, int nLen, BitmapWriteAccess* pAcc)
+ void SanitizePaletteIndexes(sal_uInt8* pEntries, int nLen, const Bitmap::ScopedWriteAccess& rAcc)
{
- sal_uInt16 nPaletteEntryCount = pAcc->GetPaletteEntryCount();
+ sal_uInt16 nPaletteEntryCount = rAcc->GetPaletteEntryCount();
for (int nX = 0; nX < nLen; ++nX)
{
if (pEntries[nX] >= nPaletteEntryCount)