Listview X9

Dimitrie O. Paun dpaun at rogers.com
Thu Oct 24 13:56:03 CDT 2002


ChangeLog
  Use iterators to render over the columns, in report mode.

--- dlls/comctl32/listview.c.X8	Thu Oct 24 13:46:08 2002
+++ dlls/comctl32/listview.c	Thu Oct 24 13:55:17 2002
@@ -3617,10 +3617,11 @@
  */
 static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD cdmode)
 {
-    INT rgntype, nFirstCol, nLastCol, nCol;
+    INT rgntype;
     RECT rcClip, rcItem;
     POINT Origin, Position;
-    ITERATOR i;
+    RANGE colRange;
+    ITERATOR i, j;
 
     TRACE("()\n");
 
@@ -3632,28 +3633,26 @@
     LISTVIEW_GetOrigin(infoPtr, &Origin);
     
     /* narrow down the columns we need to paint */
-    for(nFirstCol = 0; nFirstCol < infoPtr->hdpaColumns->nItemCount; nFirstCol++)
+    for(colRange.lower = 0; colRange.lower < infoPtr->hdpaColumns->nItemCount; colRange.lower++)
     {
-	LISTVIEW_GetHeaderRect(infoPtr, nFirstCol, &rcItem);
+	LISTVIEW_GetHeaderRect(infoPtr, colRange.lower, &rcItem);
 	if (rcItem.right + Origin.x >= rcClip.left) break;
     }
-    for(nLastCol = infoPtr->hdpaColumns->nItemCount - 1; nLastCol >= 0; nLastCol--)
+    for(colRange.upper = infoPtr->hdpaColumns->nItemCount; colRange.upper > 0; colRange.upper--)
     {
-	LISTVIEW_GetHeaderRect(infoPtr, nLastCol, &rcItem);
+	LISTVIEW_GetHeaderRect(infoPtr, colRange.upper - 1, &rcItem);
 	if (rcItem.left + Origin.x < rcClip.right) break;
     }
+    iterator_rangeitems(&j, colRange);
 
     /* figure out what we need to draw */
     iterator_visibleitems(&i, infoPtr, hdc);
     
-    /* a last few bits before we start drawing */
-    TRACE("Colums=(%d - %d)\n", nFirstCol, nLastCol);
-
     /* iterate through the invalidated rows */
     while(iterator_next(&i))
     {
 	/* iterate through the invalidated columns */
-	for (nCol = nFirstCol; nCol <= nLastCol; nCol++)
+	while(iterator_next(&j))
 	{
 	    LISTVIEW_GetItemOrigin(infoPtr, i.nItem, &Position);
 	    Position.x += Origin.x;
@@ -3661,14 +3660,14 @@
 
 	    if (rgntype == COMPLEXREGION)
 	    {
-		LISTVIEW_GetHeaderRect(infoPtr, nCol, &rcItem);
+		LISTVIEW_GetHeaderRect(infoPtr, j.nItem, &rcItem);
 		rcItem.top = 0;
 	        rcItem.bottom = infoPtr->nItemHeight;
 		OffsetRect(&rcItem, Position.x, Position.y);
 		if (!RectVisible(hdc, &rcItem)) continue;
 	    }
 
-	    LISTVIEW_DrawItem(infoPtr, hdc, i.nItem, nCol, Position, cdmode);
+	    LISTVIEW_DrawItem(infoPtr, hdc, i.nItem, j.nItem, Position, cdmode);
 	}
     }
     iterator_destroy(&i);


-- 
Dimi.




More information about the wine-patches mailing list