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

Noel Grandin noel at peralex.com
Thu May 7 02:19:42 PDT 2015


 include/vcl/bitmap.hxx       |   19 +++++++++++++------
 sd/source/ui/dlg/vectdlg.cxx |    2 +-
 vcl/source/gdi/bitmap3.cxx   |    4 ++--
 vcl/source/gdi/impvect.cxx   |   14 +++++++-------
 vcl/source/gdi/impvect.hxx   |    4 ++--
 vcl/source/outdev/text.cxx   |    2 +-
 6 files changed, 26 insertions(+), 19 deletions(-)

New commits:
commit 220c9fc2e9fa8c83a1851e3f73682d8300f6dff1
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 6 11:45:37 2015 +0200

    convert BMP_VECTORIZE constants to scoped enum
    
    Change-Id: Ifa6614f6a17356481a335a686e9ea0f9b983c5c5
    Reviewed-on: https://gerrit.libreoffice.org/15647
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 8ee2c87..a9f2146 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -71,10 +71,17 @@ namespace o3tl
     template<> struct typed_flags<BmpDitherFlags> : is_typed_flags<BmpDitherFlags, 0x07> {};
 }
 
-#define BMP_VECTORIZE_INNER         0x00000001UL
-#define BMP_VECTORIZE_OUTER         0x00000002UL
-#define BMP_VECTORIZE_BOUND_ONLY    0x00000004UL
-#define BMP_VECTORIZE_REDUCE_EDGES  0x00000008UL
+enum class BmpVectorizeFlags
+{
+    Inner         = 0x0001,
+    Outer         = 0x0002,
+    BoundOnly     = 0x0004,
+    ReduceEdges   = 0x0008,
+};
+namespace o3tl
+{
+    template<> struct typed_flags<BmpVectorizeFlags> : is_typed_flags<BmpVectorizeFlags, 0x0f> {};
+}
 
 #define BMP_COL_TRANS               Color( 252, 3, 251 )
 
@@ -721,7 +728,7 @@ public:
      */
     bool                    Vectorize(
                                 tools::PolyPolygon& rPolyPoly,
-                                sal_uLong nFlags = BMP_VECTORIZE_OUTER,
+                                BmpVectorizeFlags nFlags = BmpVectorizeFlags::Outer,
                                 const Link<>* pProgress = NULL );
 
     /** Convert the bitmap to a meta file
@@ -748,7 +755,7 @@ public:
     bool                    Vectorize(
                                 GDIMetaFile& rMtf,
                                 sal_uInt8 cReduce = 0,
-                                sal_uLong nFlags = BMP_VECTORIZE_INNER,
+                                BmpVectorizeFlags nFlags = BmpVectorizeFlags::Inner,
                                 const Link<>* pProgress = NULL );
 
     /** Change various global color characteristics
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index 99271d2..1865ac5 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -159,7 +159,7 @@ void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf )
     if( !!aTmp )
     {
         const Link<> aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) );
-        aTmp.Vectorize( rMtf, (sal_uInt8) m_pMtReduce->GetValue(), BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES, &aPrgsHdl );
+        aTmp.Vectorize( rMtf, (sal_uInt8) m_pMtReduce->GetValue(), BmpVectorizeFlags::Outer | BmpVectorizeFlags::ReduceEdges, &aPrgsHdl );
 
         if( m_pCbFillHoles->IsChecked() )
         {
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 4ed1aab..9a656d6 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -2445,12 +2445,12 @@ void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal,
     }
 }
 
-bool Bitmap::Vectorize( tools::PolyPolygon& rPolyPoly, sal_uLong nFlags, const Link<>* pProgress )
+bool Bitmap::Vectorize( tools::PolyPolygon& rPolyPoly, BmpVectorizeFlags nFlags, const Link<>* pProgress )
 {
     return ImplVectorizer::ImplVectorize( *this, rPolyPoly, nFlags, pProgress );
 }
 
-bool Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, sal_uLong nFlags, const Link<>* pProgress )
+bool Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, BmpVectorizeFlags nFlags, const Link<>* pProgress )
 {
     return ImplVectorizer::ImplVectorize( *this, rMtf, cReduce, nFlags, pProgress );
 }
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
index fb64021..166f0be 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -52,7 +52,7 @@ class ImplChain;
 namespace ImplVectorizer
 {
     ImplVectMap* ImplExpand( BitmapReadAccess* pRAcc, const Color& rColor );
-    void     ImplCalculate( ImplVectMap* pMap, tools::PolyPolygon& rPolyPoly, sal_uInt8 cReduce, sal_uLong nFlags );
+    void     ImplCalculate( ImplVectMap* pMap, tools::PolyPolygon& rPolyPoly, sal_uInt8 cReduce, BmpVectorizeFlags nFlags );
     bool     ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain );
     bool     ImplIsUp( ImplVectMap* pMap, long nY, long nX );
     void     ImplLimitPolyPoly( tools::PolyPolygon& rPolyPoly );
@@ -634,7 +634,7 @@ void ImplChain::ImplPostProcess( const ImplPointArray& rArr )
 namespace ImplVectorizer {
 
 bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
-                                    sal_uInt8 cReduce, sal_uLong nFlags, const Link<>* pProgress )
+                                    sal_uInt8 cReduce, BmpVectorizeFlags nFlags, const Link<>* pProgress )
 {
     bool bRet = false;
 
@@ -697,7 +697,7 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
                 {
                     ImplLimitPolyPoly( aPolyPoly );
 
-                    if( nFlags & BMP_VECTORIZE_REDUCE_EDGES )
+                    if( nFlags & BmpVectorizeFlags::ReduceEdges )
                         aPolyPoly.Optimize( PolyOptimizeFlags::EDGES );
 
                     if( aPolyPoly.Count() )
@@ -737,7 +737,7 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
 
 bool ImplVectorize( const Bitmap& rMonoBmp,
                                     tools::PolyPolygon& rPolyPoly,
-                                    sal_uLong nFlags, const Link<>* pProgress )
+                                    BmpVectorizeFlags nFlags, const Link<>* pProgress )
 {
     std::unique_ptr<Bitmap> xBmp(new Bitmap( rMonoBmp ));
     BitmapReadAccess*   pRAcc;
@@ -764,7 +764,7 @@ bool ImplVectorize( const Bitmap& rMonoBmp,
         xMap.reset();
         ImplLimitPolyPoly( rPolyPoly );
 
-        if( nFlags & BMP_VECTORIZE_REDUCE_EDGES )
+        if( nFlags & BmpVectorizeFlags::ReduceEdges )
             rPolyPoly.Optimize( PolyOptimizeFlags::EDGES );
 
         // #i14895#:setting the correct direction for polygons
@@ -948,7 +948,7 @@ ImplVectMap* ImplExpand( BitmapReadAccess* pRAcc, const Color& rColor )
     return pMap;
 }
 
-void ImplCalculate( ImplVectMap* pMap, tools::PolyPolygon& rPolyPoly, sal_uInt8 cReduce, sal_uLong nFlags )
+void ImplCalculate( ImplVectMap* pMap, tools::PolyPolygon& rPolyPoly, sal_uInt8 cReduce, BmpVectorizeFlags nFlags )
 {
     const long nWidth = pMap->Width(), nHeight= pMap->Height();
 
@@ -976,7 +976,7 @@ void ImplCalculate( ImplVectMap* pMap, tools::PolyPolygon& rPolyPoly, sal_uInt8
                 aChain.ImplBeginAdd( aStartPt );
                 ImplGetChain( pMap, aStartPt, aChain );
 
-                if( nFlags & BMP_VECTORIZE_INNER )
+                if( nFlags & BmpVectorizeFlags::Inner )
                     aChain.ImplEndAdd( bInner ? VECT_POLY_INLINE_INNER : VECT_POLY_INLINE_OUTER );
                 else
                     aChain.ImplEndAdd( bInner ? VECT_POLY_OUTLINE_INNER : VECT_POLY_OUTLINE_OUTER );
diff --git a/vcl/source/gdi/impvect.hxx b/vcl/source/gdi/impvect.hxx
index c2e7a48..297023d 100644
--- a/vcl/source/gdi/impvect.hxx
+++ b/vcl/source/gdi/impvect.hxx
@@ -27,9 +27,9 @@
 namespace ImplVectorizer
 {
     bool     ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
-                            sal_uInt8 cReduce, sal_uLong nFlags, const Link<>* pProgress );
+                            sal_uInt8 cReduce, BmpVectorizeFlags nFlags, const Link<>* pProgress );
     bool     ImplVectorize( const Bitmap& rMonoBmp, tools::PolyPolygon& rPolyPoly,
-                            sal_uLong nFlags, const Link<>* pProgress );
+                            BmpVectorizeFlags nFlags, const Link<>* pProgress );
 };
 
 #endif
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 79588dd..7d2e65f 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2797,7 +2797,7 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
             Bitmap aBmp( aVDev->GetBitmap(Point(0, 0), aSize));
 
             tools::PolyPolygon aPolyPoly;
-            bool bVectorized = aBmp.Vectorize(aPolyPoly, BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES);
+            bool bVectorized = aBmp.Vectorize(aPolyPoly, BmpVectorizeFlags::Outer | BmpVectorizeFlags::ReduceEdges);
             if( !bVectorized )
                 bSuccess = false;
             else


More information about the Libreoffice-commits mailing list