Prevent storing some redundant data in KItemListViewLayouter

Review Request #113487 - Created Oct. 28, 2013 and submitted

Information
Frank Reininghaus
kde-baseapps
master
Reviewers
dolphin
In KItemListViewLayouter, we store a QRectF for each item, which is "the area that the item occupies". However, the size of the QRectF is already stored in the size hint resolver.

Therefore, it is sufficient to store the position of the top left corner of the QRectF in a QPointF and construct the QRectF on demand. Even in the current version, the QRectF has to be moved by the current view offset anyway, but even if the patched version was slightly slower, it would not matter much because the QRectF is only constructed for the items which are shown on the screen (whose number may be much lower than the total number of items, for which we currently store all this redundant information).

This patch reduces the memory usage by 16 bytes per item (a QRectF is 4 doubles -> 32 byes, a QPointF only 2 doubles -> 16 bytes).
I tested scrolling and rubber-band-selecting items in all view modes and could not find any regressions.
Emmanuel Pescosta
Emmanuel Pescosta
Commit Hook
Frank Reininghaus
Review request changed

Status: Closed (submitted)

Loading...