From 73b5d3420e0227ddca7b430d72a7a0bd1b950598 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 27 Dec 2018 10:01:51 +0100 Subject: [PATCH] Fix determining shift of the drawn scrolled contents Position of the visible portion of the window should be taken as a drawing offset. See #18313. --- src/propgrid/propgrid.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index d7f211e3f1..c99c8e63c2 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -2028,7 +2028,7 @@ void wxPropertyGrid::DrawItems( wxDC& dc, #if WXWIN_COMPATIBILITY_3_0 int wxPropertyGrid::DoDrawItemsBase( wxDC& dc, const wxRect* itemsRect, - bool isBuffered ) const + bool WXUNUSED(isBuffered) ) const #else int wxPropertyGrid::DoDrawItems( wxDC& dc, const wxRect* itemsRect ) const @@ -2043,8 +2043,9 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, if ( !lastItem ) lastItem = GetLastItem( wxPG_ITERATE_VISIBLE ); - int vy; - GetViewStart(NULL, &vy); + int vx, vy; + GetViewStart(&vx, &vy); + vx *= wxPG_PIXELS_PER_UNIT; vy *= wxPG_PIXELS_PER_UNIT; if ( IsFrozen() || m_height < 1 || firstItem == NULL ) @@ -2090,22 +2091,10 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, long windowStyle = m_windowStyle; -#if WXWIN_COMPATIBILITY_3_0 - int xRelMod = 0; - - if ( isBuffered ) - { - xRelMod = itemsRect->x; - // itemsRect conversion - firstItemTopY -= vy; - lastItemBottomY -= vy; - } -#else - int xRelMod = itemsRect->x; + int xRelMod = vx; // itemsRect conversion firstItemTopY -= vy; lastItemBottomY -= vy; -#endif int x = m_marginWidth - xRelMod;