[apps/shared] ValuesController: when reloading an entire row, reload

only visible cells
This commit is contained in:
Émilie Feral
2019-10-07 10:16:54 +02:00
committed by LeaNumworks
parent b40c89cae8
commit a81f76332c

View File

@@ -226,6 +226,8 @@ double ValuesController::dataAtLocation(int columnIndex, int rowIndex) {
void ValuesController::didChangeRow(int row) {
/* Update the row memoization if it exists */
// the first row is never reloaded as it corresponds to title row
assert(row > 0);
// Conversion of coordinates from absolute table to values table
int valuesRow = valuesRowForAbsoluteRow(row);
if (m_firstMemoizedRow > valuesRow || valuesRow >= m_firstMemoizedRow + k_maxNumberOfDisplayableRows) {
@@ -237,7 +239,10 @@ void ValuesController::didChangeRow(int row) {
int maxI = numberOfValuesColumns() - m_firstMemoizedColumn;
int nbOfMemoizedColumns = numberOfMemoizedColumn();
for (int i = 0; i < minInt(nbOfMemoizedColumns, maxI); i++) {
fillMemoizedBuffer(absoluteColumnForValuesColumn(m_firstMemoizedColumn + i), row, nbOfMemoizedColumns*memoizedRow+i);
// Fill only visible cells
if (valuesRow < numberOfElementsInColumn(i)) {
fillMemoizedBuffer(absoluteColumnForValuesColumn(m_firstMemoizedColumn + i), row, nbOfMemoizedColumns*memoizedRow+i);
}
}
}