summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-05 11:12:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-05 12:02:08 +0100
commit7accac097688832d8682a88a0176c3e1482ffade (patch)
treee24edf0953b3a1c8bc297a4a464f1f1d9411b1cd /svx
parente92b89428e66ab44c6c08463b3c43200e1cf7341 (diff)
tdf#114837 FILEOPEN: Image is blank
revert commit e75abe6e0a4ea250366bb29c0ece697e9b1b80a1 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Tue Dec 12 09:33:14 2017 +0200 convert tolerance params to sal_uInt8 for now. Change-Id: Iafaada0fb338f60ecc9f94aafe138500dfb27cf7 Reviewed-on: https://gerrit.libreoffice.org/47453 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/_bmpmask.cxx63
-rw-r--r--svx/source/dialog/_contdlg.cxx2
2 files changed, 35 insertions, 30 deletions
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index a59662979ffd..f989dce82bab 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -41,9 +41,7 @@
#define TEST_COLS() \
{ \
- sal_uInt8 nR = aCol.GetRed(); \
- sal_uInt8 nG = aCol.GetGreen(); \
- sal_uInt8 nB = aCol.GetBlue(); \
+ nR = aCol.GetRed(); nG = aCol.GetGreen(); nB = aCol.GetBlue(); \
for( i = 0; i < nCount; i++ ) \
{ \
if ( ( pMinR[i] <= nR ) && ( pMaxR[i] >= nR ) && \
@@ -576,7 +574,7 @@ void SvxBmpMask::SetExecState( bool bEnable )
}
-sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uInt8* pTols )
+sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uIntPtr* pTols )
{
sal_uInt16 nCount = 0;
@@ -584,28 +582,28 @@ sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uI
{
pSrcCols[nCount] = m_pQSet1->GetItemColor( 1 );
pDstCols[nCount] = m_pLbColor1->GetSelectEntryColor();
- pTols[nCount++] = sal_uInt8(m_pSp1->GetValue());
+ pTols[nCount++] = static_cast<sal_uIntPtr>(m_pSp1->GetValue());
}
if ( m_pCbx2->IsChecked() )
{
pSrcCols[nCount] = m_pQSet2->GetItemColor( 1 );
pDstCols[nCount] = m_pLbColor2->GetSelectEntryColor();
- pTols[nCount++] = sal_uInt8(m_pSp2->GetValue());
+ pTols[nCount++] = static_cast<sal_uIntPtr>(m_pSp2->GetValue());
}
if ( m_pCbx3->IsChecked() )
{
pSrcCols[nCount] = m_pQSet3->GetItemColor( 1 );
pDstCols[nCount] = m_pLbColor3->GetSelectEntryColor();
- pTols[nCount++] = sal_uInt8(m_pSp3->GetValue());
+ pTols[nCount++] = static_cast<sal_uIntPtr>(m_pSp3->GetValue());
}
if ( m_pCbx4->IsChecked() )
{
pSrcCols[nCount] = m_pQSet4->GetItemColor( 1 );
pDstCols[nCount] = m_pLbColor4->GetSelectEntryColor();
- pTols[nCount++] = sal_uInt8(m_pSp4->GetValue());
+ pTols[nCount++] = static_cast<sal_uIntPtr>(m_pSp4->GetValue());
}
return nCount;
@@ -616,7 +614,7 @@ Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap )
Bitmap aBitmap( rBitmap );
Color pSrcCols[4];
Color pDstCols[4];
- sal_uInt8 pTols[4];
+ sal_uIntPtr pTols[4];
const sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
EnterWait();
@@ -626,7 +624,7 @@ Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap )
return aBitmap;
}
-BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, sal_uInt8 nTol )
+BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, const long nTol )
{
EnterWait();
@@ -646,7 +644,11 @@ BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color&
Animation SvxBmpMask::ImpMask( const Animation& rAnimation )
{
Animation aAnimation( rAnimation );
- sal_uInt16 nAnimationCount = aAnimation.Count();
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ InitColorArrays( pSrcCols, pDstCols, pTols );
+ sal_uInt16 nAnimationCount = aAnimation.Count();
for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
{
@@ -664,7 +666,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
GDIMetaFile aMtf;
Color pSrcCols[4];
Color pDstCols[4];
- sal_uInt8 pTols[4];
+ sal_uIntPtr pTols[4];
sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
// If no color is selected, we copy only the Mtf
@@ -674,12 +676,15 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
{
bool pTrans[4];
Color aCol;
- std::unique_ptr<sal_uInt8[]> pMinR(new sal_uInt8[nCount]);
- std::unique_ptr<sal_uInt8[]> pMaxR(new sal_uInt8[nCount]);
- std::unique_ptr<sal_uInt8[]> pMinG(new sal_uInt8[nCount]);
- std::unique_ptr<sal_uInt8[]> pMaxG(new sal_uInt8[nCount]);
- std::unique_ptr<sal_uInt8[]> pMinB(new sal_uInt8[nCount]);
- std::unique_ptr<sal_uInt8[]> pMaxB(new sal_uInt8[nCount]);
+ long nR;
+ long nG;
+ long nB;
+ std::unique_ptr<long[]> pMinR(new long[nCount]);
+ std::unique_ptr<long[]> pMaxR(new long[nCount]);
+ std::unique_ptr<long[]> pMinG(new long[nCount]);
+ std::unique_ptr<long[]> pMaxG(new long[nCount]);
+ std::unique_ptr<long[]> pMinB(new long[nCount]);
+ std::unique_ptr<long[]> pMaxB(new long[nCount]);
sal_uInt16 i;
aMtf.SetPrefSize( rMtf.GetPrefSize() );
@@ -688,19 +693,19 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
// Prepare Color comparison array
for( i = 0; i < nCount; i++ )
{
- sal_uInt8 nTol = ( pTols[i] * 255 ) / 100;
+ long nTol = ( pTols[i] * 255L ) / 100L;
- sal_uInt8 nVal = pSrcCols[i].GetRed();
- pMinR[i] = std::max<sal_uInt8>( nVal - nTol, 0 );
- pMaxR[i] = std::min<sal_uInt8>( nVal + nTol, 255 );
+ long nVal = (long) pSrcCols[i].GetRed();
+ pMinR[i] = std::max( nVal - nTol, 0L );
+ pMaxR[i] = std::min( nVal + nTol, 255L );
- nVal = pSrcCols[i].GetGreen();
- pMinG[i] = std::max<sal_uInt8>( nVal - nTol, 0 );
- pMaxG[i] = std::min<sal_uInt8>( nVal + nTol, 255 );
+ nVal = ( (long) pSrcCols[i].GetGreen() );
+ pMinG[i] = std::max( nVal - nTol, 0L );
+ pMaxG[i] = std::min( nVal + nTol, 255L );
- nVal = pSrcCols[i].GetBlue();
- pMinB[i] = std::max<sal_uInt8>( nVal - nTol, 0 );
- pMaxB[i] = std::min<sal_uInt8>( nVal + nTol, 255 );
+ nVal = ( (long) pSrcCols[i].GetBlue() );
+ pMinB[i] = std::max( nVal - nTol, 0L );
+ pMaxB[i] = std::min( nVal + nTol, 255L );
pTrans[ i ] = (pDstCols[ i ] == COL_TRANSPARENT);
}
@@ -1016,7 +1021,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
{
Color pSrcCols[4];
Color pDstCols[4];
- sal_uInt8 pTols[4];
+ sal_uIntPtr pTols[4];
sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
if( nCount )
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 9059030fc3ca..3ab740b5dfab 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -685,7 +685,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void )
if( aGraphic.GetType() == GraphicType::Bitmap )
{
Bitmap aBmp( aGraphic.GetBitmap() );
- const sal_uInt8 nTol(m_pMtfTolerance->GetValue() * 255L / 100L);
+ const long nTol = static_cast<long>(m_pMtfTolerance->GetValue() * 255L / 100L);
aMask = aBmp.CreateMask( rColor, nTol );