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

Miklos Vajna vmiklos at collabora.co.uk
Tue Aug 11 07:04:29 PDT 2015


 include/vcl/edit.hxx        |    4 ++--
 vcl/source/control/edit.cxx |   28 +++++++---------------------
 2 files changed, 9 insertions(+), 23 deletions(-)

New commits:
commit 35aa47d30c01425a303c1fdaf8651b5fa0944b3a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Aug 10 18:38:16 2015 +0200

    tdf#92982 vcl rendercontext: simplify Edit::ImplClearBackground() logic
    
    This fixes the vertical rendering artifacts visible on the bug
    screenshot with the oxygen-gtk Gtk theme, and also is a lot simpler than
    what we did here before.
    
    Change-Id: I21a167452f14ae52bd0d899b3ed467ce40540dec
    Reviewed-on: https://gerrit.libreoffice.org/17631
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit 4532ea42904e4a7d6c50f7f8ea53aaa97ec72c5e)
    Reviewed-on: https://gerrit.libreoffice.org/17643
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 634722e..80f5c56 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -105,13 +105,13 @@ private:
     SAL_DLLPRIVATE void        ImplInitEditData();
     SAL_DLLPRIVATE void        ImplModified();
     SAL_DLLPRIVATE OUString    ImplGetText() const;
-    SAL_DLLPRIVATE void        ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout = false);
+    SAL_DLLPRIVATE void        ImplRepaint(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle, bool bLayout = false);
     SAL_DLLPRIVATE void        ImplInvalidateOrRepaint();
     SAL_DLLPRIVATE void        ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uInt8 nMode );
     SAL_DLLPRIVATE void        ImplSetText( const OUString& rStr, const Selection* pNewSelection = 0 );
     SAL_DLLPRIVATE void        ImplInsertText( const OUString& rStr, const Selection* pNewSelection = 0, bool bIsUserInput = false );
     SAL_DLLPRIVATE OUString    ImplGetValidString( const OUString& rString ) const;
-    SAL_DLLPRIVATE void        ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd);
+    SAL_DLLPRIVATE void        ImplClearBackground(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle, long nXStart, long nXEnd);
     SAL_DLLPRIVATE void        ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd);
     SAL_DLLPRIVATE void        ImplShowCursor( bool bOnlyIfVisible = true );
     SAL_DLLPRIVATE void        ImplAlign();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index e9f5c82..d83b7f2 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -490,7 +490,7 @@ long Edit::ImplGetTextYPosition() const
     return ( GetOutputSizePixel().Height() - GetTextHeight() ) / 2;
 }
 
-void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout)
+void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle, bool bLayout)
 {
     if (!IsReallyVisible())
         return;
@@ -532,7 +532,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout)
     if (pCursor)
         pCursor->Hide();
 
-    ImplClearBackground(rRenderContext, 0, GetOutputSizePixel().Width());
+    ImplClearBackground(rRenderContext, rRectangle, 0, GetOutputSizePixel().Width());
 
     bool bPaintPlaceholderText = aText.isEmpty() && !maPlaceholderText.isEmpty();
 
@@ -1011,7 +1011,7 @@ int Edit::ImplGetNativeControlType() const
     return nCtrl;
 }
 
-void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd )
+void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle, long nXStart, long nXEnd )
 {
     /*
     * note: at this point the cursor must be switched off already
@@ -1027,22 +1027,8 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart,
     {
         // ImplPaintBorder() is a NOP, we have a native border, and this is a sub-edit of a control.
         // That means we have to draw the parent native widget to paint the edit area to clear our background.
-        long nLeft = mnXOffset + ImplGetExtraXOffset();
-        long nTop = ImplGetTextYPosition();
-        long nRight = GetOutputWidthPixel();
-        long nHeight = GetTextHeight();
-        Rectangle aEditArea(nLeft, nTop, nRight, nTop + nHeight);
-
-        ControlType aCtrlType = ImplGetNativeControlType();
-        ControlPart aCtrlPart = PART_ENTIRE_CONTROL;
-        Rectangle aCtrlRegion(0, 0, GetParent()->GetOutputWidthPixel(), GetParent()->GetOutputHeightPixel());
-        ControlState nState = ControlState::ENABLED;
-        ImplControlValue aControlValue;
-
-        rRenderContext.Push(PushFlags::CLIPREGION);
-        rRenderContext.SetClipRegion(vcl::Region(aEditArea));
-        rRenderContext.DrawNativeControl(aCtrlType, aCtrlPart, aCtrlRegion, nState, aControlValue, OUString());
-        rRenderContext.Pop();
+        PaintBufferGuard g(ImplGetWindowImpl()->mpFrameData, GetParent());
+        GetParent()->Paint(rRenderContext, rRectangle);
     }
 }
 
@@ -1795,10 +1781,10 @@ void Edit::FillLayoutData() const
     const_cast<Edit*>(this)->Invalidate();
 }
 
-void Edit::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
+void Edit::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle)
 {
     if (!mpSubEdit)
-        ImplRepaint(rRenderContext);
+        ImplRepaint(rRenderContext, rRectangle);
 }
 
 void Edit::Resize()


More information about the Libreoffice-commits mailing list