summaryrefslogtreecommitdiff
path: root/emfio/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-19 09:31:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-19 10:13:47 +0100
commita4664759fea89e91f5c0f26ee47f2747925642c6 (patch)
treef38edb5a6af76c987110e16d628d713f83d2b2a2 /emfio/source
parent6fbb6d80fe6203ff6f84ee85ca625b6e60bf5bae (diff)
use RawBitmap in W_META_BITBLT
part of making BitmapWriteAccess an internal detail of vcl/ Change-Id: I23393872fca5a924ceb7ca70edd8e6f70a3cfc13 Reviewed-on: https://gerrit.libreoffice.org/49965 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'emfio/source')
-rw-r--r--emfio/source/reader/wmfreader.cxx46
1 files changed, 21 insertions, 25 deletions
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx
index 233b2f5552a3..734954a6e63e 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -32,6 +32,7 @@
#include <tools/fract.hxx>
#include <o3tl/make_unique.hxx>
#include <vcl/bitmapaccess.hxx>
+#include <vcl/BitmapTools.hxx>
#include <osl/thread.h>
// MS Windows defines
@@ -714,39 +715,34 @@ namespace emfio
}
if (bOk)
{
- Bitmap aBmp( Size( nWidth, nHeight ), nBitCount );
- Bitmap::ScopedWriteAccess pAcc(aBmp);
- if ( pAcc )
+ vcl::bitmap::RawBitmap aBmp( Size( nWidth, nHeight ) );
+ for (sal_uInt16 y = 0; y < nHeight && mpInputStream->good(); ++y)
{
- for (sal_uInt16 y = 0; y < nHeight && mpInputStream->good(); ++y)
+ sal_uInt16 x = 0;
+ for (sal_uInt16 scan = 0; scan < nBytesPerScan; scan++ )
{
- Scanline pScanline = pAcc->GetScanline( y );
- sal_uInt16 x = 0;
- for (sal_uInt16 scan = 0; scan < nBytesPerScan; scan++ )
+ sal_Int8 nEightPixels = 0;
+ mpInputStream->ReadSChar( nEightPixels );
+ for (sal_Int8 i = 7; i >= 0; i-- )
{
- sal_Int8 nEightPixels = 0;
- mpInputStream->ReadSChar( nEightPixels );
- for (sal_Int8 i = 7; i >= 0; i-- )
+ if ( x < nWidth )
{
- if ( x < nWidth )
- {
- pAcc->SetPixelOnData( pScanline, x, BitmapColor((nEightPixels>>i)&1) );
- }
- x++;
+ aBmp.SetPixel( y, x, Color(((nEightPixels>>i)&1) ? COL_BLACK : COL_WHITE) );
}
+ x++;
}
}
- pAcc.reset();
- if ( nSye && nSxe &&
- ( nSx + nSxe <= aBmp.GetSizePixel().Width() ) &&
- ( nSy + nSye <= aBmp.GetSizePixel().Height() ) )
- {
- tools::Rectangle aCropRect( Point( nSx, nSy ), Size( nSxe, nSye ) );
- aBmp.Crop( aCropRect );
- }
- tools::Rectangle aDestRect( aPoint, Size( nSxe, nSye ) );
- maBmpSaveList.emplace_back(new BSaveStruct(aBmp, aDestRect, nWinROP));
}
+ BitmapEx aBitmap = vcl::bitmap::CreateFromData(std::move(aBmp));
+ if ( nSye && nSxe &&
+ ( nSx + nSxe <= nWidth ) &&
+ ( nSy + nSye <= nHeight ) )
+ {
+ tools::Rectangle aCropRect( Point( nSx, nSy ), Size( nSxe, nSye ) );
+ aBitmap.Crop( aCropRect );
+ }
+ tools::Rectangle aDestRect( aPoint, Size( nSxe, nSye ) );
+ maBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aDestRect, nWinROP));
}
}
break;