Owen Rudge : comctl32: Add absolute version of iterator_frameditems.
Alexandre Julliard
julliard at winehq.org
Wed Nov 4 10:26:23 CST 2009
Module: wine
Branch: master
Commit: 14991b78d8cdac5b46752d6c42c0fb15c882141d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=14991b78d8cdac5b46752d6c42c0fb15c882141d
Author: Owen Rudge <orudge at codeweavers.com>
Date: Mon Nov 2 10:57:41 2009 -0600
comctl32: Add absolute version of iterator_frameditems.
---
dlls/comctl32/listview.c | 53 ++++++++++++++++++++++++++++-----------------
1 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 952c589..4bedd89 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1268,20 +1268,17 @@ static inline BOOL iterator_rangesitems(ITERATOR* i, RANGES ranges)
}
/***
- * Creates an iterator over the items which intersect lprc.
+ * Creates an iterator over the items which intersect frame.
+ * Uses absolute coordinates rather than compensating for the current offset.
*/
-static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *lprc)
+static BOOL iterator_frameditems_absolute(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *frame)
{
- RECT frame = *lprc, rcItem, rcTemp;
- POINT Origin;
+ RECT rcItem, rcTemp;
/* in case we fail, we want to return an empty iterator */
if (!iterator_empty(i)) return FALSE;
- LISTVIEW_GetOrigin(infoPtr, &Origin);
-
- TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc));
- OffsetRect(&frame, -Origin.x, -Origin.y);
+ TRACE("(frame=%s)\n", wine_dbgstr_rect(frame));
if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)
{
@@ -1290,7 +1287,7 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
if (infoPtr->uView == LV_VIEW_ICON && infoPtr->nFocusedItem != -1)
{
LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcItem);
- if (IntersectRect(&rcTemp, &rcItem, lprc))
+ if (IntersectRect(&rcTemp, &rcItem, frame))
i->nSpecial = infoPtr->nFocusedItem;
}
if (!(iterator_rangesitems(i, ranges_create(50)))) return FALSE;
@@ -1302,7 +1299,7 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
rcItem.top = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
rcItem.right = rcItem.left + infoPtr->nItemWidth;
rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
- if (IntersectRect(&rcTemp, &rcItem, &frame))
+ if (IntersectRect(&rcTemp, &rcItem, frame))
ranges_additem(i->ranges, nItem);
}
return TRUE;
@@ -1311,11 +1308,11 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
{
RANGE range;
- if (frame.left >= infoPtr->nItemWidth) return TRUE;
- if (frame.top >= infoPtr->nItemHeight * infoPtr->nItemCount) return TRUE;
+ if (frame->left >= infoPtr->nItemWidth) return TRUE;
+ if (frame->top >= infoPtr->nItemHeight * infoPtr->nItemCount) return TRUE;
- range.lower = max(frame.top / infoPtr->nItemHeight, 0);
- range.upper = min((frame.bottom - 1) / infoPtr->nItemHeight, infoPtr->nItemCount - 1) + 1;
+ range.lower = max(frame->top / infoPtr->nItemHeight, 0);
+ range.upper = min((frame->bottom - 1) / infoPtr->nItemHeight, infoPtr->nItemCount - 1) + 1;
if (range.upper <= range.lower) return TRUE;
if (!iterator_rangeitems(i, range)) return FALSE;
TRACE(" report=%s\n", debugrange(&i->range));
@@ -1323,8 +1320,8 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
else
{
INT nPerCol = max((infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight, 1);
- INT nFirstRow = max(frame.top / infoPtr->nItemHeight, 0);
- INT nLastRow = min((frame.bottom - 1) / infoPtr->nItemHeight, nPerCol - 1);
+ INT nFirstRow = max(frame->top / infoPtr->nItemHeight, 0);
+ INT nLastRow = min((frame->bottom - 1) / infoPtr->nItemHeight, nPerCol - 1);
INT nFirstCol;
INT nLastCol;
INT lower;
@@ -1333,13 +1330,13 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
if (infoPtr->nItemWidth)
{
- nFirstCol = max(frame.left / infoPtr->nItemWidth, 0);
- nLastCol = min((frame.right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
+ nFirstCol = max(frame->left / infoPtr->nItemWidth, 0);
+ nLastCol = min((frame->right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
}
else
{
- nFirstCol = max(frame.left, 0);
- nLastCol = min(frame.right - 1, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
+ nFirstCol = max(frame->left, 0);
+ nLastCol = min(frame->right - 1, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
}
lower = nFirstCol * nPerCol + nFirstRow;
@@ -1365,6 +1362,22 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
}
/***
+ * Creates an iterator over the items which intersect lprc.
+ */
+static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *lprc)
+{
+ RECT frame = *lprc;
+ POINT Origin;
+
+ TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc));
+
+ LISTVIEW_GetOrigin(infoPtr, &Origin);
+ OffsetRect(&frame, -Origin.x, -Origin.y);
+
+ return iterator_frameditems_absolute(i, infoPtr, &frame);
+}
+
+/***
* Creates an iterator over the items which intersect the visible region of hdc.
*/
static BOOL iterator_visibleitems(ITERATOR *i, const LISTVIEW_INFO *infoPtr, HDC hdc)
More information about the wine-cvs
mailing list