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

Unified Diff: samples/swarm/swarm_ui_lib/view/MeasureText.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/swarm_ui_lib/view/MeasureText.dart
diff --git a/samples/swarm/swarm_ui_lib/view/MeasureText.dart b/samples/swarm/swarm_ui_lib/view/MeasureText.dart
index d3c40077e01133a8f018f9a18789b77054a4a0b1..eecf5093f7581fbfb00f8e21d56da5314b40bfff 100644
--- a/samples/swarm/swarm_ui_lib/view/MeasureText.dart
+++ b/samples/swarm/swarm_ui_lib/view/MeasureText.dart
@@ -45,7 +45,7 @@ class MeasureText {
}
String quickTruncate(String text, num lineWidth, int maxLines) {
- int targetLength = (lineWidth * maxLines / _typicalCharLength).toInt();
+ int targetLength = (lineWidth * maxLines / _typicalCharLength).truncate();
Lasse Reichstein Nielsen 2013/01/04 10:29:42 ~/
floitsch 2013/03/11 13:39:15 Done in a different CL.
// Advance to next word break point.
while(targetLength < text.length && !isWhitespace(text[targetLength])) {
targetLength++;
@@ -74,7 +74,7 @@ class MeasureText {
// the number of lines and not the actual linebreaks is required.
if (sb == null) {
_context.font = font;
- int textWidth = _context.measureText(text).width.toInt();
+ int textWidth = _context.measureText(text).width.truncate();
// By the pigeon hole principle, the resulting text will require at least
// maxLines if the raw text is longer than the amount of text that will
// fit on maxLines - 1. We add the length of a whitespace

Powered by Google App Engine
This is Rietveld 408576698