[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sc/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 11 15:25:26 UTC 2019


 sc/source/ui/view/notemark.cxx |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 600fbb77a0869723dd00b6ec1643bac1be2e211c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Apr 11 09:13:59 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Apr 11 17:25:04 2019 +0200

    tdf#122767 sc opengl: fix rendering artifacts after hiding a cell comment
    
    Actually this is not specific to opengl, affects e.g. the Linux gen
    backend as well, it just doesn't happen with the Windows gdi backend.
    
    The rendering of the caption itself was OK. Focusing on the arrow
    polygon at the end of the comment's "tail" (connector polyline):
    
    - What gets painted is determined by SdrCaptionObj ->
      ViewContactOfSdrCaptionObj::createViewIndependentPrimitive2DSequence(),
      which produces a PolyPolygonColorPrimitive2D, which is then processed by
      VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect().
    
    - The polygon passed to VCL there is within the bounds of the
      invalidation rectangle set in ScNoteMarker::TimeHdl().
    
    So it seems the only reason sometimes these 1px rendering artifacts are
    left around is anti-aliasing. Fix those by simply extending the
    invalidation rectangle in each direction.
    
    (cherry picked from commit 37aa4f0d64e276c46821ef6122483fb6b4c04781)
    
    Change-Id: I37b8e666999d3ff5ee1328fca7ac017ee8c7e9e0
    Reviewed-on: https://gerrit.libreoffice.org/70585
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx
index b18d54a44173..87da6bed3333 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -172,21 +172,30 @@ void ScNoteMarker::InvalidateWin()
 {
     if (m_bVisible)
     {
-        m_pWindow->Invalidate( OutputDevice::LogicToLogic(m_aRect, m_aMapMode, m_pWindow->GetMapMode()) );
+        // Extend the invalidated rectangle by 1 pixel in each direction in case AA would slightly
+        // paint outside the nominal area.
+        tools::Rectangle aRect(m_aRect);
+        const Size aPixelSize = m_pWindow->PixelToLogic(Size(1, 1));
+        aRect.AdjustLeft(-aPixelSize.getWidth());
+        aRect.AdjustTop(-aPixelSize.getHeight());
+        aRect.AdjustRight(aPixelSize.getWidth());
+        aRect.AdjustBottom(aPixelSize.getHeight());
+
+        m_pWindow->Invalidate( OutputDevice::LogicToLogic(aRect, m_aMapMode, m_pWindow->GetMapMode()) );
 
         if ( m_pRightWin || m_pBottomWin )
         {
             Size aWinSize = m_pWindow->PixelToLogic( m_pWindow->GetOutputSizePixel(), m_aMapMode );
             if ( m_pRightWin )
-                m_pRightWin->Invalidate( OutputDevice::LogicToLogic(m_aRect,
+                m_pRightWin->Invalidate( OutputDevice::LogicToLogic(aRect,
                                         lcl_MoveMapMode( m_aMapMode, Size( aWinSize.Width(), 0 ) ),
                                         m_pRightWin->GetMapMode()) );
             if ( m_pBottomWin )
-                m_pBottomWin->Invalidate( OutputDevice::LogicToLogic(m_aRect,
+                m_pBottomWin->Invalidate( OutputDevice::LogicToLogic(aRect,
                                         lcl_MoveMapMode( m_aMapMode, Size( 0, aWinSize.Height() ) ),
                                         m_pBottomWin->GetMapMode()) );
             if ( m_pDiagWin )
-                m_pDiagWin->Invalidate( OutputDevice::LogicToLogic(m_aRect,
+                m_pDiagWin->Invalidate( OutputDevice::LogicToLogic(aRect,
                                         lcl_MoveMapMode( m_aMapMode, aWinSize ),
                                         m_pDiagWin->GetMapMode()) );
         }


More information about the Libreoffice-commits mailing list