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

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 16 11:07:58 UTC 2018


 include/svx/xoutbmp.hxx             |    2 --
 include/vcl/outdev.hxx              |    3 ---
 svx/source/dialog/graphctl.cxx      |   20 +-------------------
 svx/source/xoutdev/_xoutbmp.cxx     |   12 ------------
 sw/source/core/view/viewsh.cxx      |    8 ++++----
 vcl/source/filter/graphicfilter.cxx |   10 ++--------
 vcl/source/outdev/outdev.cxx        |    7 -------
 7 files changed, 7 insertions(+), 55 deletions(-)

New commits:
commit 494f565506013015d9ce4a3010eb3b211557d70f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Mar 16 10:37:12 2018 +0200

    don't bother dithering for 256bit displays
    
    which surely are a minority by now
    
    Also drop the GetColorCount() method on OutputDevice and clean up the
    remaining call sites to use GetBitCount()
    
    Change-Id: I4e2c6f2523796f7df7f54eb005f1539e34d9ea40
    Reviewed-on: https://gerrit.libreoffice.org/51389
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/include/svx/xoutbmp.hxx b/include/svx/xoutbmp.hxx
index 23249ffb94a1..0f7ae80d95b2 100644
--- a/include/svx/xoutbmp.hxx
+++ b/include/svx/xoutbmp.hxx
@@ -75,8 +75,6 @@ public:
                                        const tools::Rectangle* pWorkRect );
 };
 
-SVX_DLLPUBLIC bool DitherBitmap( Bitmap& rBitmap );
-
 #endif // INCLUDED_SVX_XOUTBMP_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index ff90e3fb40da..e2cec1c195dd 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -464,9 +464,6 @@ public:
     Size                        GetOutputSize() const
                                     { return PixelToLogic( GetOutputSizePixel() ); }
 
-    sal_uLong                   GetColorCount() const;
-
-
     css::uno::Reference< css::awt::XGraphics >
                                 CreateUnoGraphics();
     std::vector< VCLXGraphics* > *GetUnoGraphicsList() const  { return mpUnoGraphicsList; }
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 30a856a2780a..ac285f0d8305 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -163,25 +163,7 @@ void GraphCtrl::InitSdrModel()
 
 void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel )
 {
-    // If possible we dither bitmaps for the display
-    if ( rGraphic.GetType() == GraphicType::Bitmap  )
-    {
-        if ( rGraphic.IsTransparent() )
-        {
-            Bitmap  aBmp( rGraphic.GetBitmap() );
-
-            DitherBitmap( aBmp );
-            aGraphic = Graphic( BitmapEx( aBmp, rGraphic.GetBitmapEx().GetMask() ) );
-        }
-        else
-        {
-            Bitmap aBmp( rGraphic.GetBitmap() );
-            DitherBitmap( aBmp );
-            aGraphic = aBmp;
-        }
-    }
-    else
-        aGraphic = rGraphic;
+    aGraphic = rGraphic;
 
     if ( aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
         aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 );
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index a6e072197e8c..edc9e0a228f2 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -666,16 +666,4 @@ tools::Polygon XOutBitmap::GetContour( const Bitmap& rBmp, const XOutFlags nFlag
     return aRetPoly;
 }
 
-bool DitherBitmap( Bitmap& rBitmap )
-{
-    bool bRet = false;
-
-    if( ( rBitmap.GetBitCount() >= 8 ) && ( Application::GetDefaultDevice()->GetColorCount() < 257 ) )
-        bRet = rBitmap.Dither( BmpDitherFlags::Floyd );
-    else
-        bRet = false;
-
-    return bRet;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 533e20d26a78..7c536e86117f 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1223,19 +1223,19 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const tools::Rectangle
 #if !defined(MACOSX) && !defined(ANDROID) && !defined(IOS)
     // #i98766# - disable smooth scrolling for Mac
 
-    const sal_uLong nColCnt = mpOut->GetColorCount();
+    const sal_uLong nBitCnt = mpOut->GetBitCount();
     long lMult = 1, lMax = LONG_MAX;
-    if ( nColCnt == 65536 )
+    if ( nBitCnt == 16 )
     {
         lMax = 7000;
         lMult = 2;
     }
-    if ( nColCnt == 16777216 )
+    if ( nBitCnt == 24 )
     {
         lMax = 5000;
         lMult = 6;
     }
-    else if ( nColCnt == 1 )
+    else if ( nBitCnt == 1 )
     {
         lMax = 3000;
         lMult = 12;
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 115bc476782d..273e500a0806 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1936,7 +1936,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
         if( eType != GraphicType::Bitmap )
         {
             Size aSizePixel;
-            sal_uLong nColorCount,nBitsPerPixel,nNeededMem,nMaxMem;
+            sal_uLong nBitsPerPixel,nNeededMem,nMaxMem;
             ScopedVclPtrInstance< VirtualDevice > aVirDev;
 
             nMaxMem = 1024;
@@ -1946,13 +1946,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
             aSizePixel=aVirDev->LogicToPixel(aGraphic.GetPrefSize(),aGraphic.GetPrefMapMode());
 
             // Calculate how much memory the image will take up
-            nColorCount=aVirDev->GetColorCount();
-            if      (nColorCount<=2)     nBitsPerPixel=1;
-            else if (nColorCount<=4)     nBitsPerPixel=2;
-            else if (nColorCount<=16)    nBitsPerPixel=4;
-            else if (nColorCount<=256)   nBitsPerPixel=8;
-            else if (nColorCount<=65536) nBitsPerPixel=16;
-            else                         nBitsPerPixel=24;
+            nBitsPerPixel=aVirDev->GetBitCount();
             nNeededMem=(static_cast<sal_uLong>(aSizePixel.Width())*static_cast<sal_uLong>(aSizePixel.Height())*nBitsPerPixel+7)/8;
 
             // is the image larger than available memory?
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 4c556a10e08b..b44eedda0818 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -379,13 +379,6 @@ void OutputDevice::SetOutOffYPixel(long nOutOffY)
     mnOutOffY = nOutOffY;
 }
 
-sal_uLong OutputDevice::GetColorCount() const
-{
-
-    const sal_uInt16 nBitCount = GetBitCount();
-    return( ( nBitCount > 31 ) ? ULONG_MAX : ( ( sal_uLong(1) ) << nBitCount) );
-}
-
 css::uno::Reference< css::awt::XGraphics > OutputDevice::CreateUnoGraphics()
 {
     UnoWrapperBase* pWrapper = Application::GetUnoWrapper();


More information about the Libreoffice-commits mailing list