[Libreoffice-commits] core.git: 2 commits - include/svx include/vcl svx/source vcl/source

2019-07-05 Thread Noel Grandin (via logerrit)
 include/svx/xoutbmp.hxx |   10 -
 include/vcl/bitmapex.hxx|4 
 svx/source/dialog/_contdlg.cxx  |9 -
 svx/source/xoutdev/_xoutbmp.cxx |  230 ---
 vcl/source/gdi/bitmapex.cxx |  232 
 vcl/source/gdi/impgraph.cxx |3 
 6 files changed, 242 insertions(+), 246 deletions(-)

New commits:
commit f2c3ea4f54d634ab54702d6fe07ccd4d4d76bdc1
Author: Noel Grandin 
AuthorDate: Thu Jul 4 15:05:41 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 5 08:46:46 2019 +0200

tdf#121740 improve ppt load time on windows, reduce image swapout

Reduces load time of this file by 10%.

This logic is here since
  commit 8ab086b6cc054501bfbf7ef6fa509c393691e860
  Date:   Mon Sep 18 16:07:07 2000 +
  initial import
and there does not seem to be any good reason to immediately trigger a 
swapout.

Our balancing logic will perform a swapout as necessary.

Change-Id: I02592dfd3bde1a00bcca2fcbcd4d38aacc8f3de4
Reviewed-on: https://gerrit.libreoffice.org/75086
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 5a621025423f..195e40d1a45a 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1652,9 +1652,6 @@ void ImpGraphic::ImplSetLink(const 
std::shared_ptr& rGfxLink)
 ensureAvailable();
 
 mpGfxLink = rGfxLink;
-
-if (mpGfxLink && mpGfxLink->IsNative())
-mpGfxLink->SwapOut();
 }
 
 GfxLink ImpGraphic::ImplGetLink()
commit 7f4fe205c4b1baf01115a9e0d74655818d03ec40
Author: Noel Grandin 
AuthorDate: Thu Jul 4 14:26:41 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 5 08:46:36 2019 +0200

move the contour-finding code inside vcl

Change-Id: Iac52b72831868a917fc445e970edabc1c2585b55
Reviewed-on: https://gerrit.libreoffice.org/75080
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/svx/xoutbmp.hxx b/include/svx/xoutbmp.hxx
index 09d55e3d8d51..8635ed86a30c 100644
--- a/include/svx/xoutbmp.hxx
+++ b/include/svx/xoutbmp.hxx
@@ -33,9 +33,6 @@ enum class XOutFlags {
 NONE = 0x,
 MirrorHorz   = 0x0001,
 MirrorVert   = 0x0010,
-ContourHorz  = 0x0001,
-ContourVert  = 0x0002,
-ContourEdgeDetect= 0x0004,
 DontAddExtension = 0x0008,
 DontExpandFilename   = 0x0001,
 UseGifIfPossible = 0x0002,
@@ -43,7 +40,7 @@ enum class XOutFlags {
 UseNativeIfPossible  = 0x0008,
 };
 namespace o3tl {
-template<> struct typed_flags : is_typed_flags {};
+template<> struct typed_flags : is_typed_flags {};
 }
 
 class GraphicFilter;
@@ -72,11 +69,6 @@ public:
 static ErrCode  ExportGraphic( const Graphic& rGraphic, const 
INetURLObject& rURL,
GraphicFilter& rFilter, const 
sal_uInt16 nFormat,
const css::uno::Sequence< 
css::beans::PropertyValue >* pFilterData );
-
-static Bitmap   DetectEdges( const Bitmap& rBmp, const sal_uInt8 
cThreshold );
-
-static tools::Polygon GetContour( const Bitmap& rBmp, const XOutFlags 
nContourFlags,
-   const tools::Rectangle* pWorkRect );
 };
 
 #endif // INCLUDED_SVX_XOUTBMP_HXX
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index c3d27edf9d91..71da7cb45dc8 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -318,6 +318,10 @@ public:
  */
 voidReplaceTransparency( const Color& rColor );
 
+/** Get contours in image */
+tools::Polygon  GetContour( bool bContourEdgeDetect, bool bContourVert,
+const tools::Rectangle* pWorkRect );
+
 /** Change various global color characteristics
 
 @param nLuminancePercent
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 2832eece6ec2..cc7da3c25fd6 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -86,7 +86,8 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const 
Graphic& rGraphic,
  const tools::Rectangle* 
pRect )
 {
 Bitmap  aBmp;
-XOutFlags nContourFlags = XOutFlags::ContourHorz;
+bool bContourEdgeDetect = false;
+bool bContourVert = false;
 
 if ( rGraphic.GetType() == GraphicType::Bitmap )
 {
@@ -125,7 +126,7 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const 
Graphic& rGraphic,
 else
 {
 aBmp = rGraphic.GetBitmapEx().GetBitmap();
-nContourFlags |= XOutFlags::ContourEdgeDetect;
+bContourEdgeDetect = true;
 }
 }
 else if( rGraphic.GetType() != GraphicType::NONE )
@@ -157,13 +158,13 @@ tools::PolyPolygon 

[Libreoffice-commits] core.git: 2 commits - include/svx include/vcl svx/source vcl/source

2019-07-04 Thread Noel Grandin (via logerrit)
 include/svx/bmpmask.hxx|4 ---
 include/vcl/bitmapex.hxx   |   31 ++--
 svx/source/dialog/_bmpmask.cxx |   44 -
 vcl/source/gdi/bitmapex.cxx|   21 +++
 4 files changed, 59 insertions(+), 41 deletions(-)

New commits:
commit e27be9dfbcf8636a7440f828435b1860dfa38977
Author: Noel Grandin 
AuthorDate: Wed Jul 3 15:07:44 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 4 09:18:22 2019 +0200

move some Bitmap replace logic inside vcl

i.e. behind BitmapEx

Change-Id: Ibe5a20ffe127acf7fb5bcf6341dcd046371aa761
Reviewed-on: https://gerrit.libreoffice.org/75044
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx
index 05420369ca35..1d75ccf094bd 100644
--- a/include/svx/bmpmask.hxx
+++ b/include/svx/bmpmask.hxx
@@ -132,7 +132,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public 
SfxDockingWindow
 sal_uInt16  InitColorArrays( Color* pSrcCols, Color* pDstCols,
  sal_uInt8* pTols );
 
-Bitmap  ImpMask( const Bitmap& rBitmap );
+voidImpMask( BitmapEx& rBitmap );
 GDIMetaFile ImpMask( const GDIMetaFile& rMtf );
 Animation   ImpMask( const Animation& rAnimation );
 BitmapExImpMaskTransparent( const BitmapEx& rBitmapEx,
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 5f8a41f1ed20..2abbddd2e3c7 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -291,6 +291,30 @@ public:
 const Color* pReplaceColors,
 sal_uLong nColorCount );
 
+/** Replace all pixel having one the search colors with the corresponding 
replace color
+
+@param pSearchColors
+Array of colors specifying which pixel should be replaced
+
+@param rReplaceColors
+Array of colors to be placed in all changed pixel
+
+@param nColorCount
+Size of the aforementioned color arrays
+
+@param pTols
+Tolerance value. Specifies the maximal difference between
+pSearchColor colors and the individual pixel values, such that
+the corresponding pixel is still regarded a match.
+
+@return true, if the operation was completed successfully.
+ */
+voidReplace(
+const Color* pSearchColors,
+const Color* pReplaceColors,
+sal_uLong nColorCount,
+sal_uInt8 const * pTols );
+
 /** Replace transparency with given color.
  */
 voidReplaceTransparency( const Color& rColor );
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 1eb212f9f636..a37e3e8c4693 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -608,19 +608,16 @@ sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, 
Color* pDstCols, sal_uI
 return nCount;
 }
 
-Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap )
+void SvxBmpMask::ImpMask( BitmapEx& rBitmap )
 {
-Bitmap  aBitmap( rBitmap );
 Color   pSrcCols[4];
 Color   pDstCols[4];
 sal_uInt8   pTols[4];
 const sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
 
 EnterWait();
-aBitmap.Replace( pSrcCols, pDstCols, nCount, pTols );
+rBitmap.Replace( pSrcCols, pDstCols, nCount, pTols );
 LeaveWait();
-
-return aBitmap;
 }
 
 BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const 
Color& rColor, const sal_uInt8 nTol )
@@ -1006,15 +1003,10 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
 }
 
 // now replace it again with the normal colors
-Bitmap  aBitmap( ImpMask( 
aGraphic.GetBitmapEx().GetBitmap() ) );
-SizeaSize( aBitmap.GetSizePixel() );
-
-if ( aSize.Width() && aSize.Height() )
+BitmapEx  aBitmapEx( aGraphic.GetBitmapEx() );
+if ( aBitmapEx.GetSizePixel().Width() && 
aBitmapEx.GetSizePixel().Height() )
 {
-if ( aGraphic.IsTransparent() )
-aGraphic = Graphic( BitmapEx( aBitmap, 
aGraphic.GetBitmapEx().GetMask() ) );
-else
-aGraphic = aBitmap;
+ImpMask( aBitmapEx );
 }
 }
 }
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 06fe72f8cd25..3681e585ac84 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -1294,6 +1294,14 @@ void BitmapEx::Replace(const Color& rSearchColor,