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

Tamás Zolnai tamas.zolnai at collabora.com
Thu May 17 23:44:02 UTC 2018


 include/vcl/floatwin.hxx       |    2 +-
 include/vcl/window.hxx         |   11 ++++++++++-
 vcl/source/window/floatwin.cxx |    2 +-
 vcl/source/window/paint.cxx    |   13 ++++++++++++-
 4 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit 25eddbb2cf56a5a24892a7023862fdb5ea23d38d
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Thu May 17 18:23:30 2018 +0200

    Avoid mixing up units in LogicRectangle method
    
    For main document window we use logic coordinates, but
    for dialog / floating windows we use pixels. Use a different
    method name to make it clear which unit we use in the code.
    
    Change-Id: I7aee7a03013d24e1a2e37072e224e7d4e7830f02
    Reviewed-on: https://gerrit.libreoffice.org/54500
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 60531a5478a3..62739f95cb8d 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -130,7 +130,7 @@ public:
     SAL_DLLPRIVATE tools::Rectangle&       ImplGetItemEdgeClipRect();
     SAL_DLLPRIVATE bool             ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
     virtual        void             doDeferredInit(WinBits nBits) override;
-                   void             LogicInvalidate(const tools::Rectangle* pRectangle) override;
+                   void             PixelInvalidate(const tools::Rectangle* pRectangle) override;
 
 public:
     explicit        FloatingWindow(vcl::Window* pParent, WinBits nStyle);
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 1c27a8737f42..d8d394edfa98 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1074,11 +1074,20 @@ public:
     virtual void                        Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
     virtual void                        Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
     /**
-     * Notification about some rectangle of the output device got invalidated.
+     * Notification about some rectangle of the output device got invalidated.Used for the main
+     * document window.
      *
      * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
      */
     virtual void                        LogicInvalidate(const tools::Rectangle* pRectangle);
+
+    /**
+     * Notification about some rectangle of the output device got invalidated. Used for the
+     * dialogs and floating windows (e.g. conext menu, popup).
+     *
+     * @param pRectangle If 0, that means the whole area, otherwise the area in pixel coordinates.
+     */
+    virtual void                        PixelInvalidate(const tools::Rectangle* pRectangle);
     void                                Validate();
     bool                                HasPaintEvent() const;
     void                                Update();
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index f52aafeac5ab..1a6166dd5b92 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -590,7 +590,7 @@ bool FloatingWindow::EventNotify( NotifyEvent& rNEvt )
     return bRet;
 }
 
-void FloatingWindow::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
+void FloatingWindow::PixelInvalidate(const tools::Rectangle* /*pRectangle*/)
 {
     if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
     {
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 415429cec76c..294367559cc9 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1189,6 +1189,17 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
 
 void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
 {
+    if(pRectangle)
+    {
+        tools::Rectangle aRect = GetOutDev()->ImplLogicToDevicePixel( *pRectangle );
+        PixelInvalidate(&aRect);
+    }
+    else
+        PixelInvalidate(nullptr);
+}
+
+void Window::PixelInvalidate(const tools::Rectangle* pRectangle)
+{
     if (comphelper::LibreOfficeKit::isDialogPainting() || !comphelper::LibreOfficeKit::isActive())
         return;
 
@@ -1210,7 +1221,7 @@ void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
     else if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
     {
         const tools::Rectangle aRect(Point(GetOutOffXPixel(), GetOutOffYPixel()), GetSizePixel());
-        pParent->LogicInvalidate(&aRect);
+        pParent->PixelInvalidate(&aRect);
     }
 }
 


More information about the Libreoffice-commits mailing list