TreeUtil#getVisibleRowCount optimized when tree has fixed row height (part of IDEA-192253)

GitOrigin-RevId: 67582bd2de96717410baa898836465c18027daa3
This commit is contained in:
Tagir Valeev
2019-09-12 12:01:13 +00:00
committed by intellij-monorepo-bot
parent 2dc5dc9ae9
commit fe1e4b820b
@@ -720,6 +720,13 @@ public final class TreeUtil {
if (visible == null) return 0;
int rowHeight = tree.getRowHeight();
if (rowHeight > 0) {
int firstRow = visible.y / rowHeight;
int lastRow = (visible.y + visible.height) / rowHeight;
return lastRow - firstRow + 1;
}
int count = 0;
for (int i=0; i < tree.getRowCount(); i++) {
final Rectangle bounds = tree.getRowBounds(i);