summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-05 10:04:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-05 14:44:28 +0200
commit1c4cd77beeec3b40fb73afa8b77dbf897451a2aa (patch)
treec35cb2bf06a74581609d5f7a590735e260616748 /forms
parent7b5f5d77d56ee494647d9e7868546b3f2140896e (diff)
forms - move the Bitmap accessing code inside BitmapEx
Change-Id: I58d5200332c133146adb6bb99b4b88697f03990a Reviewed-on: https://gerrit.libreoffice.org/55313 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/imgprod.cxx82
1 files changed, 19 insertions, 63 deletions
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
index 3b161e3d6d2c..0b55ecd942f1 100644
--- a/forms/source/component/imgprod.cxx
+++ b/forms/source/component/imgprod.cxx
@@ -329,71 +329,27 @@ void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
void ImageProducer::ImplInitConsumer( const Graphic& rGraphic )
{
- Bitmap aBmp( rGraphic.GetBitmapEx().GetBitmap() );
- BitmapReadAccess* pBmpAcc = aBmp.AcquireReadAccess();
-
- if( pBmpAcc )
+ sal_uInt32 nRMask = 0;
+ sal_uInt32 nGMask = 0;
+ sal_uInt32 nBMask = 0;
+ sal_uInt32 nAMask = 0;
+ sal_uInt32 nWidth = 0;
+ sal_uInt32 nHeight = 0;
+ sal_uInt8 nBitCount = 0;
+ css::uno::Sequence< sal_Int32 > aRGBPal;
+ rGraphic.GetBitmapEx().GetColorModel(aRGBPal, nRMask, nGMask, nBMask, nAMask, mnTransIndex, nWidth, nHeight, nBitCount);
+
+ // create temporary list to hold interfaces
+ ConsumerList_t aTmp = maConsList;
+
+ // iterate through interfaces
+ for (auto const& elem : aTmp)
{
- sal_uInt16 nPalCount = 0;
- sal_uInt32 nRMask = 0;
- sal_uInt32 nGMask = 0;
- sal_uInt32 nBMask = 0;
- sal_uInt32 nAMask = 0;
- css::uno::Sequence< sal_Int32 > aRGBPal;
-
- if( pBmpAcc->HasPalette() )
- {
- nPalCount = pBmpAcc->GetPaletteEntryCount();
-
- if( nPalCount )
- {
- aRGBPal = css::uno::Sequence< sal_Int32 >( nPalCount + 1 );
-
- sal_Int32* pTmp = aRGBPal.getArray();
-
- for( sal_uInt32 i = 0; i < nPalCount; i++, pTmp++ )
- {
- const BitmapColor& rCol = pBmpAcc->GetPaletteColor( static_cast<sal_uInt16>(i) );
-
- *pTmp = static_cast<sal_Int32>(rCol.GetRed()) << sal_Int32(24);
- *pTmp |= static_cast<sal_Int32>(rCol.GetGreen()) << sal_Int32(16);
- *pTmp |= static_cast<sal_Int32>(rCol.GetBlue()) << sal_Int32(8);
- *pTmp |= sal_Int32(0x000000ffL);
- }
-
- if( rGraphic.IsTransparent() )
- {
- // append transparent entry
- *pTmp = sal_Int32(0xffffff00L);
- mnTransIndex = nPalCount;
- nPalCount++;
- }
- else
- mnTransIndex = 0;
-
- }
- }
- else
- {
- nRMask = 0xff000000UL;
- nGMask = 0x00ff0000UL;
- nBMask = 0x0000ff00UL;
- nAMask = 0x000000ffUL;
- }
-
- // create temporary list to hold interfaces
- ConsumerList_t aTmp = maConsList;
-
- // iterate through interfaces
- for (auto const& elem : aTmp)
- {
- elem->init( pBmpAcc->Width(), pBmpAcc->Height() );
- elem->setColorModel( pBmpAcc->GetBitCount(),aRGBPal, nRMask, nGMask, nBMask, nAMask );
- }
-
- Bitmap::ReleaseAccess( pBmpAcc );
- mbConsInit = true;
+ elem->init( nWidth, nHeight );
+ elem->setColorModel( nBitCount,aRGBPal, nRMask, nGMask, nBMask, nAMask );
}
+
+ mbConsInit = true;
}