comctl32/listview: do not draw unnecessary grid lines

Daniel Jelinski djelinski1 at gmail.com
Fri Aug 31 19:15:02 CDT 2012


-------------- next part --------------
From ff09bccc76d8a7f1a95efe22f8388a42200a59b5 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Fri, 31 Aug 2012 21:15:32 +0200
Subject: [PATCH] comctl32: do not draw unnecessary grid lines

Previous version drew all lines from the first item to the last visible item, using clip rectangle to filter out the unnecessary ones.
This exposed a bug (or feature, not sure) in MoveTo/LineTo, which truncate the point coordinates to 16 bits before drawing a line,
which in turn caused bug 31460.

The fix causes only lines between visible items to be drawn, which also speeds redrawing up.
---
 dlls/comctl32/listview.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index e1b9a71..6e2c63c 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -4943,10 +4943,7 @@ static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, HDC hdc)
         itemheight =  LISTVIEW_CalculateItemHeight(infoPtr);
         rcItem.left   = infoPtr->rcList.left;
         rcItem.right  = infoPtr->rcList.right;
-        rcItem.bottom = rcItem.top = Origin.y - 1;
-        MoveToEx(hdc, rcItem.left, rcItem.top, NULL);
-        LineTo(hdc, rcItem.right, rcItem.top);
-        for(y=itemheight-1+Origin.y; y<=infoPtr->rcList.bottom; y+=itemheight)
+        for(y=Origin.y>1?Origin.y-1:itemheight-1+Origin.y%itemheight; y<=infoPtr->rcList.bottom; y+=itemheight)
         {
             rcItem.bottom = rcItem.top = y;
             TRACE("horz rcItem=%s\n", wine_dbgstr_rect(&rcItem));
-- 
1.7.5.4


More information about the wine-patches mailing list