[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - include/vcl vcl/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jul 30 00:51:49 PDT 2015


 include/vcl/outdev.hxx        |   11 ++++++
 include/vcl/window.hxx        |    7 ----
 vcl/source/outdev/rect.cxx    |   66 ++++++++++++++++++++++++++++++++++++++++
 vcl/source/window/window2.cxx |   68 ------------------------------------------
 4 files changed, 77 insertions(+), 75 deletions(-)

New commits:
commit d3e7bac9172b7302d29792ffc480955b7a7b6896
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jul 28 17:40:22 2015 +0200

    tdf#92982 vcl: move Invert() member functions from vcl::Window to OutputDevice
    
    With this, vcl::Cursor will be able to paint to a vcl::RenderContext,
    too; not just directly, which is needed for double-buffering.
    
    (cherry picked from commit 09bd5846d57bf6b506b0967d664b2f80562e03fc)
    
    Conflicts:
    	include/vcl/window.hxx
    	vcl/source/window/window2.cxx
    
    Change-Id: I868f6cd9b08afe59611ef266911a894a26cacedc
    Reviewed-on: https://gerrit.libreoffice.org/17401
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4a8dd85..c2e334c 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -289,6 +289,10 @@ namespace o3tl
     template<> struct typed_flags<GetDefaultFontFlags> : is_typed_flags<GetDefaultFontFlags, 0x01> {};
 }
 
+// Flags for Invert()
+#define INVERT_HIGHLIGHT                ((sal_uInt16)0x0001)
+#define INVERT_50                       ((sal_uInt16)0x0002)
+
 enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
 
 enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OUTDEV_VIEWTYPE_SLIDESHOW };
@@ -766,6 +770,13 @@ public:
 
     ///@}
 
+    /** @name Invert functions
+     */
+    ///@{
+public:
+    void                                Invert( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
+    void                                Invert( const Polygon& rPoly, sal_uInt16 nFlags = 0 );
+    ///@}
 
     /** @name Line functions
      */
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index f1d7a92..e598ead 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -217,10 +217,6 @@ namespace o3tl
 #define PARENTCLIPMODE_CLIP             ((sal_uInt16)0x0001)
 #define PARENTCLIPMODE_NOCLIP           ((sal_uInt16)0x0002)
 
-// Flags for Invert()
-#define INVERT_HIGHLIGHT                ((sal_uInt16)0x0001)
-#define INVERT_50                       ((sal_uInt16)0x0002)
-
 // Flags for ShowTracking()
 #define SHOWTRACK_SMALL                 ((sal_uInt16)0x0001)
 #define SHOWTRACK_BIG                   ((sal_uInt16)0x0002)
@@ -1143,9 +1139,6 @@ public:
     virtual void                        ShowFocus(const Rectangle& rRect);
     void                                HideFocus();
 
-    void                                Invert( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
-    void                                Invert( const Polygon& rPoly, sal_uInt16 nFlags = 0 );
-
     // transparent background for selected or checked items in toolboxes etc.
     void                                DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly );
     // the same, but fills a passed Color with a text color complementing the selection background
diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx
index b06a52b..dfa491a 100644
--- a/vcl/source/outdev/rect.cxx
+++ b/vcl/source/outdev/rect.cxx
@@ -129,6 +129,72 @@ void OutputDevice::DrawRect( const Rectangle& rRect,
         mpAlphaVDev->DrawRect( rRect, nHorzRound, nVertRound );
 }
 
+void OutputDevice::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
+{
+    if ( !IsDeviceOutputNecessary() )
+        return;
+
+    Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+
+    if ( aRect.IsEmpty() )
+        return;
+    aRect.Justify();
+
+    // we need a graphics
+    if ( !mpGraphics )
+    {
+        if ( !AcquireGraphics() )
+            return;
+    }
+
+    if ( mbInitClipRegion )
+        InitClipRegion();
+
+    if ( mbOutputClipped )
+        return;
+
+    SalInvert nSalFlags = 0;
+    if ( nFlags & INVERT_HIGHLIGHT )
+        nSalFlags |= SAL_INVERT_HIGHLIGHT;
+    if ( nFlags & INVERT_50 )
+        nSalFlags |= SAL_INVERT_50;
+    mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags, this );
+}
+
+void OutputDevice::Invert( const Polygon& rPoly, sal_uInt16 nFlags )
+{
+    if ( !IsDeviceOutputNecessary() )
+        return;
+
+    sal_uInt16 nPoints = rPoly.GetSize();
+
+    if ( nPoints < 2 )
+        return;
+
+    Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
+
+    // we need a graphics
+    if ( !mpGraphics )
+    {
+        if ( !AcquireGraphics() )
+            return;
+    }
+
+    if ( mbInitClipRegion )
+        InitClipRegion();
+
+    if ( mbOutputClipped )
+        return;
+
+    SalInvert nSalFlags = 0;
+    if ( nFlags & INVERT_HIGHLIGHT )
+        nSalFlags |= SAL_INVERT_HIGHLIGHT;
+    if ( nFlags & INVERT_50 )
+        nSalFlags |= SAL_INVERT_50;
+    const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry());
+    mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this );
+}
+
 void OutputDevice::DrawCheckered(const Point& rPos, const Size& rSize, sal_uInt32 nLen, Color aStart, Color aEnd)
 {
     assert(!is_double_buffered_window());
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 3850aa0..e3c19d5 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -127,74 +127,6 @@ void Window::HideFocus()
     mpWindowImpl->mbInHideFocus = false;
 }
 
-void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
-{
-    if ( !IsDeviceOutputNecessary() )
-        return;
-
-    OutputDevice *pOutDev = GetOutDev();
-    Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
-
-    if ( aRect.IsEmpty() )
-        return;
-    aRect.Justify();
-
-    // we need a graphics
-    if ( !mpGraphics )
-    {
-        if ( !pOutDev->AcquireGraphics() )
-            return;
-    }
-
-    if ( mbInitClipRegion )
-        InitClipRegion();
-
-    if ( mbOutputClipped )
-        return;
-
-    SalInvert nSalFlags = 0;
-    if ( nFlags & INVERT_HIGHLIGHT )
-        nSalFlags |= SAL_INVERT_HIGHLIGHT;
-    if ( nFlags & INVERT_50 )
-        nSalFlags |= SAL_INVERT_50;
-    mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags, this );
-}
-
-void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags )
-{
-    if ( !IsDeviceOutputNecessary() )
-        return;
-
-    sal_uInt16 nPoints = rPoly.GetSize();
-
-    if ( nPoints < 2 )
-        return;
-
-    OutputDevice *pOutDev = GetOutDev();
-    Polygon aPoly( pOutDev->ImplLogicToDevicePixel( rPoly ) );
-
-    // we need a graphics
-    if ( !mpGraphics )
-    {
-        if ( !pOutDev->AcquireGraphics() )
-            return;
-    }
-
-    if ( mbInitClipRegion )
-        InitClipRegion();
-
-    if ( mbOutputClipped )
-        return;
-
-    SalInvert nSalFlags = 0;
-    if ( nFlags & INVERT_HIGHLIGHT )
-        nSalFlags |= SAL_INVERT_HIGHLIGHT;
-    if ( nFlags & INVERT_50 )
-        nSalFlags |= SAL_INVERT_50;
-    const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry());
-    mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this );
-}
-
 void Window::ShowTracking( const Rectangle& rRect, sal_uInt16 nFlags )
 {
     ImplWinData* pWinData = ImplGetWinData();


More information about the Libreoffice-commits mailing list