Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: samples/swarm/Views.dart

Issue 11748016: Make ~/, round, ceil, floor, truncate return ints. Remove toInt. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Checked mode fixes. Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samples/swarm/Views.dart
diff --git a/samples/swarm/Views.dart b/samples/swarm/Views.dart
index 296af9e52f5a9d599d71854af654cdcb0da080aa..b8ace079f9060becacb8704f80965d91e89a184d 100644
--- a/samples/swarm/Views.dart
+++ b/samples/swarm/Views.dart
@@ -670,19 +670,19 @@ class FixedSizeListViewLayout<D> implements ListViewLayout<D> {
int getPageLength(int viewLength) {
final itemsPerPage = (viewLength / _itemLength).floor();
- return (Math.max(1, itemsPerPage) * _itemLength).toInt();
+ return (Math.max(1, itemsPerPage) * _itemLength);
}
int getPage(int index, int viewLength) {
- return (getOffset(index) / getPageLength(viewLength)).floor().toInt();
+ return (getOffset(index) / getPageLength(viewLength)).floor();
Lasse Reichstein Nielsen 2013/01/04 10:29:42 ~/ ?
}
int getPageStartIndex(int page, int viewLength) {
- return (getPageLength(viewLength) / _itemLength).toInt() * page;
+ return (getPageLength(viewLength) ~/ _itemLength) * page;
}
int getSnapIndex(num offset, int viewLength) {
- int index = (-offset / _itemLength).round().toInt();
+ int index = (-offset / _itemLength).round();
if (_paginate) {
index = getPageStartIndex(getPage(index, viewLength), viewLength);
}
@@ -692,13 +692,12 @@ class FixedSizeListViewLayout<D> implements ListViewLayout<D> {
Interval computeVisibleInterval(
num offset, num viewLength, num bufferLength) {
num targetIntervalStart =
- Math.max(0,((-offset - bufferLength) / _itemLength).floor());
+ Math.max(0, (-offset - bufferLength) ~/ _itemLength);
num targetIntervalEnd = GoogleMath.clamp(
((-offset + viewLength + bufferLength) / _itemLength).ceil(),
targetIntervalStart,
_data.length);
- return new Interval(targetIntervalStart.toInt(),
- targetIntervalEnd.toInt());
+ return new Interval(targetIntervalStart, targetIntervalEnd.truncate());
}
}
@@ -806,7 +805,7 @@ class VariableSizeListViewLayout<D> implements ListViewLayout<D> {
(_data.length / (_itemOffsets.length - 2));
}
return (lengthFromAllButLastElement +
- Math.max(viewLength, _lengths[_lengths.length - 1])).toInt();
+ Math.max(viewLength, _lengths[_lengths.length - 1])).truncate();
} else {
if (_lengths.length == 1) {
return Math.max(viewLength, _lengths[0]);
@@ -862,7 +861,7 @@ class VariableSizeListViewLayout<D> implements ListViewLayout<D> {
Interval computeVisibleInterval(
num offset, num viewLength, num bufferLength) {
- offset = offset.toInt();
+ offset = offset.truncate();
int start = _findFirstItemBefore(
-offset - bufferLength,
_lastVisibleInterval != null ? _lastVisibleInterval.start : 0);

Powered by Google App Engine
This is Rietveld 408576698