From f8904e156fafa6b25eb70d50bbb0029fd0e1a3dd Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 4 Jun 2009 01:43:28 +0400 Subject: [PATCH] comctl32/listview: Improve item visibility calculation for report view. --- dlls/comctl32/listview.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index b83c697f7d3..63500f2737f 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -4096,7 +4096,8 @@ static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, INT rgntype; RECT rcClip, rcItem; POINT Origin, Position; - RANGE colRange; + RANGES colRanges; + INT col, index; ITERATOR j; TRACE("()\n"); @@ -4107,19 +4108,19 @@ static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, /* Get scroll info once before loop */ LISTVIEW_GetOrigin(infoPtr, &Origin); - + + colRanges = ranges_create(DPA_GetPtrCount(infoPtr->hdpaColumns)); + /* narrow down the columns we need to paint */ - for(colRange.lower = 0; colRange.lower < DPA_GetPtrCount(infoPtr->hdpaColumns); colRange.lower++) + for(col = 0; col < DPA_GetPtrCount(infoPtr->hdpaColumns); col++) { - LISTVIEW_GetHeaderRect(infoPtr, colRange.lower, &rcItem); - if (rcItem.right + Origin.x >= rcClip.left) break; + index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, col, 0); + + LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem); + if ((rcItem.right + Origin.x >= rcClip.left) && (rcItem.left + Origin.x < rcClip.right)) + ranges_additem(colRanges, index); } - for(colRange.upper = DPA_GetPtrCount(infoPtr->hdpaColumns); colRange.upper > 0; colRange.upper--) - { - LISTVIEW_GetHeaderRect(infoPtr, colRange.upper - 1, &rcItem); - if (rcItem.left + Origin.x < rcClip.right) break; - } - iterator_rangeitems(&j, colRange); + iterator_rangesitems(&j, colRanges); /* in full row select, we _have_ to draw the main item */ if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)