projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix possible error if negative grid columns set
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
layouting
/
grid-impl.cpp
diff --git
a/dali-toolkit/internal/layouting/grid-impl.cpp
b/dali-toolkit/internal/layouting/grid-impl.cpp
index
b8e2b22
..
af9b82e
100644
(file)
--- a/
dali-toolkit/internal/layouting/grid-impl.cpp
+++ b/
dali-toolkit/internal/layouting/grid-impl.cpp
@@
-66,7
+66,7
@@
void Grid::SetNumberOfColumns( int columns )
// Store value and Relayout if changed.
if( columns != mNumColumns )
{
// Store value and Relayout if changed.
if( columns != mNumColumns )
{
- mNumColumns =
columns
;
+ mNumColumns =
std::max( 1, columns )
;
RequestLayout();
}
}
RequestLayout();
}
}
@@
-186,11
+186,11
@@
void Grid::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpe
// Grid expands to fit content
// If number of columns AUTO_FIT then set to 1 column.
// Grid expands to fit content
// If number of columns AUTO_FIT then set to 1 column.
-
+ mNumColumns = ( mNumColumns > 0 ) ? mNumColumns : 1;
// Calculate numbers of rows, round down result as later check for remainder.
// Calculate numbers of rows, round down result as later check for remainder.
- mNumRows = childCount /
( ( mNumColumns ) ? mNumColumns : 1 )
;
+ mNumRows = childCount /
mNumColumns
;
// If number of cells not cleanly dividable by colums, add another row to house remainder cells.
// If number of cells not cleanly dividable by colums, add another row to house remainder cells.
- mNumRows += ( childCount %
( ( mNumColumns ) ? mNumColumns : 1 )
) ? 1 : 0;
+ mNumRows += ( childCount %
mNumColumns
) ? 1 : 0;
availableContentHeight = desiredChildHeight * mNumRows;
}
availableContentHeight = desiredChildHeight * mNumRows;
}