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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 9 10:08:00 UTC 2019


 cui/source/tabpages/tppattern.cxx |    9 +++------
 include/svx/xbtmpit.hxx           |    2 --
 include/vcl/BitmapTools.hxx       |    2 +-
 svx/source/dialog/dlgctrl.cxx     |   21 ++++-----------------
 svx/source/xoutdev/xattrbmp.cxx   |    2 +-
 vcl/source/bitmap/BitmapTools.cxx |    6 +++---
 6 files changed, 12 insertions(+), 30 deletions(-)

New commits:
commit 05a8749ee6f251d4b92eecb97763fa1fe94c68c8
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Apr 9 09:58:27 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Apr 9 12:07:36 2019 +0200

    remove some usages of BitmapColor outside of VCL
    
    You get BitmapColor only from reading pixels from a Bitmap and
    we want to avoid usage of Bitmap outside of VCL (and use BitmapEx
    as the alternative which will eventually replace Bitmap).
    
    Change-Id: Iddfa3ef739bfdd4dce5fb47fd9f67a5a36f3388b
    Reviewed-on: https://gerrit.libreoffice.org/70447
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index 878c1ae8b98d..0bb433f00c65 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -296,9 +296,9 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void)
 
     if(pGraphicObject)
     {
-        BitmapColor aBack;
-        BitmapColor aFront;
-        bool bIs8x8(vcl::bitmap::isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBack, aFront));
+        Color aBackColor;
+        Color aPixelColor;
+        bool bIs8x8(vcl::bitmap::isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBackColor, aPixelColor));
 
         m_xLbColor->SetNoSelection();
         m_xLbBackgroundColor->SetNoSelection();
@@ -313,9 +313,6 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void)
 
             m_xCtlPixel->SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx());
 
-            Color aPixelColor = aFront.GetColor();
-            Color aBackColor = aBack.GetColor();
-
             m_xLbColor->SelectEntry( aPixelColor );
             m_xLbBackgroundColor->SelectEntry( aBackColor );
 
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
index 463fc6e78d63..7da764f7f9ac 100644
--- a/include/svx/xbtmpit.hxx
+++ b/include/svx/xbtmpit.hxx
@@ -26,8 +26,6 @@
 #include <array>
 
 class SdrModel;
-class BitmapColor;
-
 
 // class XFillBitmapItem
 
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index 0099358476c0..81b062fefdc1 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -125,7 +125,7 @@ VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx co
 // helper to construct historical 8x8 bitmaps with two colors
 
 BitmapEx VCL_DLLPUBLIC createHistorical8x8FromArray(std::array<sal_uInt8,64> const & pArray, Color aColorPix, Color aColorBack);
-bool VCL_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront);
+bool VCL_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, Color& o_rBack, Color& o_rFront);
 
 VCL_DLLPUBLIC bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult);
 
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 8b280e334051..01ad02c96341 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -873,25 +873,12 @@ void SvxPixelCtl::LoseFocus()
 
 void SvxPixelCtl::SetXBitmap(const BitmapEx& rBitmapEx)
 {
-    BitmapColor aBack;
-    BitmapColor aFront;
-
-    if (vcl::bitmap::isHistorical8x8(rBitmapEx, aBack, aFront))
+    if (vcl::bitmap::isHistorical8x8(rBitmapEx, aBackgroundColor, aPixelColor))
     {
-        Bitmap aBitmap(rBitmapEx.GetBitmap());
-        Bitmap::ScopedReadAccess pRead(aBitmap);
-
-        aBackgroundColor = aBack.GetColor();
-        aPixelColor = aFront.GetColor();
-
-        for(sal_uInt16 i(0); i < nSquares; i++)
+        for (sal_uInt16 i = 0; i < nSquares; i++)
         {
-            const BitmapColor aColor(pRead->GetColor(i/8, i%8));
-
-            if (aColor == aBack)
-                maPixelData[i] = 0;
-            else
-                maPixelData[i] = 1;
+            Color aColor = rBitmapEx.GetPixelColor(i%8, i/8);
+            maPixelData[i] = (aColor == aBackgroundColor) ? 0 : 1;
         }
     }
 }
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index e15e11bc808c..140718bd056f 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -164,7 +164,7 @@ bool XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
 
 bool XFillBitmapItem::isPattern() const
 {
-    BitmapColor aBack, aFront;
+    Color aBack, aFront;
     return vcl::bitmap::isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmapEx(), aBack, aFront);
 }
 
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 6f14c3526d42..5610c7347755 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -1004,7 +1004,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
         return BitmapEx(aBitmap);
     }
 
-    bool isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront)
+    bool isHistorical8x8(const BitmapEx& rBitmapEx, Color& o_rBack, Color& o_rFront)
     {
         bool bRet(false);
 
@@ -1026,8 +1026,8 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
 
                             // #i123564# background and foreground were exchanged; of course
                             // rPalette[0] is the background color
-                            o_rFront = rPalette[1];
-                            o_rBack = rPalette[0];
+                            o_rFront = rPalette[1].GetColor();
+                            o_rBack = rPalette[0].GetColor();
 
                             bRet = true;
                         }


More information about the Libreoffice-commits mailing list