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

Unified Diff: ui/gfx/animation/tween.cc

Issue 649203003: Type conversion fixes, ui/gfx/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test 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
Index: ui/gfx/animation/tween.cc
diff --git a/ui/gfx/animation/tween.cc b/ui/gfx/animation/tween.cc
index 483d772b5b4d47f4f7ba7f65d391f665df5819db..cf43ea5316f6b51062248054f665d25268379d1d 100644
--- a/ui/gfx/animation/tween.cc
+++ b/ui/gfx/animation/tween.cc
@@ -71,7 +71,8 @@ double Tween::CalculateValue(Tween::Type type, double state) {
namespace {
uint8 FloatToColorByte(float f) {
- return std::min(std::max(ToRoundedInt(f * 255.f), 0), 255);
+ return static_cast<uint8>(
+ std::min(std::max(ToRoundedInt(f * 255.f), 0), 255));
}
uint8 BlendColorComponents(uint8 start,
@@ -149,7 +150,8 @@ int Tween::IntValueBetween(double value, int start, int target) {
//static
int Tween::LinearIntValueBetween(double value, int start, int target) {
- return std::floor(0.5 + DoubleValueBetween(value, start, target));
+ return static_cast<int>(
danakj 2014/10/18 18:40:06 Can you ToFlooredInt here instead of cast+std::flo
Peter Kasting 2014/10/20 23:38:56 I can do even better and use ToRoundedInt() to eli
+ std::floor(0.5 + DoubleValueBetween(value, start, target)));
}
// static

Powered by Google App Engine
This is Rietveld 408576698