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

Unified Diff: ui/gfx/canvas.cc

Issue 660953002: Type conversion fixes, text rendering edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | ui/gfx/canvas_skia.cc » ('j') | ui/gfx/canvas_skia.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.cc
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
index 7ce7c4725ecb39041d534c57fdb26ea3abca8f4b..5ba9385e1dc85724fcc71f1791bc27746fcb83e2 100644
--- a/ui/gfx/canvas.cc
+++ b/ui/gfx/canvas.cc
@@ -92,12 +92,12 @@ void Canvas::SizeStringInt(const base::string16& text,
int* height,
int line_height,
int flags) {
- float fractional_width = *width;
- float factional_height = *height;
+ float fractional_width = static_cast<float>(*width);
+ float factional_height = static_cast<float>(*height);
SizeStringFloat(text, font_list, &fractional_width,
&factional_height, line_height, flags);
- *width = std::ceil(fractional_width);
- *height = std::ceil(factional_height);
+ *width = static_cast<int>(std::ceil(fractional_width));
msw 2014/10/17 22:13:23 nit q: DCHECK when the int type can't support the
Peter Kasting 2014/10/21 01:20:45 Changed to ToCeiledInt() for these, which saturate
+ *height = static_cast<int>(std::ceil(factional_height));
}
// static
« no previous file with comments | « no previous file | ui/gfx/canvas_skia.cc » ('j') | ui/gfx/canvas_skia.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698