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

Chris Sherlock chris.sherlock79 at gmail.com
Wed Feb 5 06:39:38 PST 2014


 vcl/source/window/window.cxx  |   16 +++++++++-------
 vcl/source/window/window2.cxx |   19 +++++++++++--------
 vcl/source/window/winproc.cxx |    8 +++++---
 3 files changed, 25 insertions(+), 18 deletions(-)

New commits:
commit e45c729da21c6923032b64c543136efe066b756a
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Feb 3 21:48:31 2014 +1100

    fdo#74424 Use Window::GetOutDev() to access ImplLogicToDevicePixel()
    
    Part of the decoupling of Window from OutputDevice. We now get
    the Window's OutputDevice instance and manipulate this. Do not rely
    on the inherited function.
    
    Conflicts:
    	vcl/source/window/window.cxx
    	vcl/source/window/window2.cxx
    
    Change-Id: I5e5241ed9eb586bc31ae9411cd7eef460aa707c3
    Reviewed-on: https://gerrit.libreoffice.org/7800
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6aa8d7b..a5ebc0c 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2983,6 +2983,8 @@ void Window::ImplScroll( const Rectangle& rRect,
     if ( !mpWindowImpl->mpFirstChild )
         bScrollChildren = sal_False;
 
+    OutputDevice *pOutDev = GetOutDev();
+
     // --- RTL --- check if this window requires special action
     sal_Bool bReMirror = ( ImplIsAntiparallel() );
 
@@ -2991,7 +2993,6 @@ void Window::ImplScroll( const Rectangle& rRect,
     {
         // --- RTL --- make sure the invalidate region of this window is
         // computed in the same coordinate space as the one from the overlap windows
-        const OutputDevice *pOutDev = GetOutDev();
         pOutDev->ImplReMirror( aRectMirror );
     }
 
@@ -3055,9 +3056,6 @@ void Window::ImplScroll( const Rectangle& rRect,
         SalGraphics* pGraphics = ImplGetFrameGraphics();
         if ( pGraphics )
         {
-
-            OutputDevice *pOutDev = GetOutDev();
-
             if( bReMirror )
             {
                 // --- RTL --- frame coordinates require re-mirroring
@@ -4221,7 +4219,8 @@ void Window::ImplNewInputContext()
     aNewContext.mpFont = NULL;
     if (!rFontName.isEmpty())
     {
-        Size aSize = pFocusWin->ImplLogicToDevicePixel( rFont.GetSize() );
+        OutputDevice *pFocusWinOutDev = pFocusWin->GetOutDev();
+        Size aSize = pFocusWinOutDev->ImplLogicToDevicePixel( rFont.GetSize() );
         if ( !aSize.Height() )
         {
             // only set default sizes if the font height in logical
@@ -7328,7 +7327,8 @@ void Window::Scroll( long nHorzScroll, long nVertScroll,
                      const Rectangle& rRect, sal_uInt16 nFlags )
 {
 
-    Rectangle aRect = ImplLogicToDevicePixel( rRect );
+    OutputDevice *pOutDev = GetOutDev();
+    Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect );
     aRect.Intersection( Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ) );
     if ( !aRect.IsEmpty() )
         ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags );
@@ -7353,7 +7353,9 @@ void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags )
     if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
         return;
 
-    Rectangle aRect = ImplLogicToDevicePixel( rRect );
+
+    OutputDevice *pOutDev = GetOutDev();
+    Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect );
     if ( !aRect.IsEmpty() )
     {
         Region aRegion( aRect );
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 2689957..0af2550 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -378,7 +378,8 @@ void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
     if ( !IsDeviceOutputNecessary() )
         return;
 
-    Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+    OutputDevice *pOutDev = GetOutDev();
+    Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
 
     if ( aRect.IsEmpty() )
         return;
@@ -387,7 +388,7 @@ void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
     // we need a graphics
     if ( !mpGraphics )
     {
-        if ( !ImplGetGraphics() )
+        if ( !pOutDev->ImplGetGraphics() )
             return;
     }
 
@@ -417,7 +418,8 @@ void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags )
     if ( nPoints < 2 )
         return;
 
-    Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
+    OutputDevice *pOutDev = GetOutDev();
+    Polygon aPoly( pOutDev->ImplLogicToDevicePixel( rPoly ) );
 
     // we need a graphics
     if ( !mpGraphics )
@@ -486,7 +488,8 @@ void Window::HideTracking()
 
 void Window::InvertTracking( const Rectangle& rRect, sal_uInt16 nFlags )
 {
-    Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+    OutputDevice *pOutDev = GetOutDev();
+    Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
 
     if ( aRect.IsEmpty() )
         return;
@@ -523,7 +526,6 @@ void Window::InvertTracking( const Rectangle& rRect, sal_uInt16 nFlags )
             Point aPoint( mnOutOffX, mnOutOffY );
             Region aRegion( Rectangle( aPoint,
                                        Size( mnOutWidth, mnOutHeight ) ) );
-            OutputDevice *pOutDev = GetOutDev();
             ImplClipBoundaries( aRegion, sal_False, sal_False );
             pOutDev->ImplSelectClipRegion( aRegion, pGraphics );
         }
@@ -555,7 +557,9 @@ void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags )
     if ( nPoints < 2 )
         return;
 
-    Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
+    OutputDevice *pOutDev = GetOutDev();
+
+    Polygon aPoly( pOutDev->ImplLogicToDevicePixel( rPoly ) );
 
     SalGraphics* pGraphics;
 
@@ -567,7 +571,7 @@ void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags )
         // we need a graphics
         if ( !mpGraphics )
         {
-            if ( !ImplGetGraphics() )
+            if ( !pOutDev->ImplGetGraphics() )
                 return;
         }
 
@@ -588,7 +592,6 @@ void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags )
             Point aPoint( mnOutOffX, mnOutOffY );
             Region aRegion( Rectangle( aPoint,
                                        Size( mnOutWidth, mnOutHeight ) ) );
-            OutputDevice *pOutDev = GetOutDev();
             ImplClipBoundaries( aRegion, sal_False, sal_False );
             pOutDev->ImplSelectClipRegion( aRegion, pGraphics );
         }
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 7d68061..a1a625f 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1322,16 +1322,17 @@ static void ImplHandleExtTextInputPos( Window* pWindow,
 
     if ( pChild )
     {
+        const OutputDevice *pChildOutDev = pChild->GetOutDev();
         ImplCallCommand( pChild, COMMAND_CURSORPOS );
         const Rectangle* pRect = pChild->GetCursorRect();
         if ( pRect )
-            rRect = pChild->ImplLogicToDevicePixel( *pRect );
+            rRect = pChildOutDev->ImplLogicToDevicePixel( *pRect );
         else
         {
             Cursor* pCursor = pChild->GetCursor();
             if ( pCursor )
             {
-                Point aPos = pChild->ImplLogicToDevicePixel( pCursor->GetPos() );
+                Point aPos = pChildOutDev->ImplLogicToDevicePixel( pCursor->GetPos() );
                 Size aSize = pChild->LogicToPixel( pCursor->GetSize() );
                 if ( !aSize.Width() )
                     aSize.Width() = pChild->GetSettings().GetStyleSettings().GetCursorSize();
@@ -2318,8 +2319,9 @@ static void ImplHandleSalQueryCharPosition( Window *pWindow,
         ImplWinData* pWinData = pChild->ImplGetWinData();
         if ( pWinData->mpCompositionCharRects && pEvt->mnCharPos < static_cast<sal_uLong>( pWinData->mnCompositionCharRects ) )
         {
+            OutputDevice *pChildOutDev = pChild->GetOutDev();
             const Rectangle& aRect = pWinData->mpCompositionCharRects[ pEvt->mnCharPos ];
-            Rectangle aDeviceRect = pChild->ImplLogicToDevicePixel( aRect );
+            Rectangle aDeviceRect = pChildOutDev->ImplLogicToDevicePixel( aRect );
             Point aAbsScreenPos = pChild->OutputToAbsoluteScreenPixel( pChild->ScreenToOutputPixel(aDeviceRect.TopLeft()) );
             pEvt->mnCursorBoundX = aAbsScreenPos.X();
             pEvt->mnCursorBoundY = aAbsScreenPos.Y();


More information about the Libreoffice-commits mailing list