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

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

Issue 1543183002: Switch to standard integer types in ui/gfx/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « ui/gfx/animation/tween.h ('k') | ui/gfx/animation/tween_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/animation/tween.cc
diff --git a/ui/gfx/animation/tween.cc b/ui/gfx/animation/tween.cc
index 79b074cbbf67b1d54fcf6da7c695c9c44cee7f24..15bdf5da89372ea637ba9fa28e551949f1d21fdd 100644
--- a/ui/gfx/animation/tween.cc
+++ b/ui/gfx/animation/tween.cc
@@ -5,19 +5,20 @@
#include "ui/gfx/animation/tween.h"
#include <math.h>
-
-#if defined(OS_WIN)
-#include <float.h>
-#endif
+#include <stdint.h>
#include <algorithm>
-#include "base/basictypes.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
+#include "build/build_config.h"
#include "ui/gfx/geometry/cubic_bezier.h"
#include "ui/gfx/geometry/safe_integer_conversions.h"
+#if defined(OS_WIN)
+#include <float.h>
+#endif
+
namespace gfx {
// static
@@ -71,16 +72,16 @@ double Tween::CalculateValue(Tween::Type type, double state) {
}
namespace {
-uint8 FloatToColorByte(float f) {
- return base::saturated_cast<uint8>(ToRoundedInt(f * 255.f));
+uint8_t FloatToColorByte(float f) {
+ return base::saturated_cast<uint8_t>(ToRoundedInt(f * 255.f));
}
-uint8 BlendColorComponents(uint8 start,
- uint8 target,
- float start_alpha,
- float target_alpha,
- float blended_alpha,
- double progress) {
+uint8_t BlendColorComponents(uint8_t start,
+ uint8_t target,
+ float start_alpha,
+ float target_alpha,
+ float blended_alpha,
+ double progress) {
// Since progress can be outside [0, 1], blending can produce a value outside
// [0, 255].
float blended_premultiplied = Tween::FloatValueBetween(
@@ -99,24 +100,15 @@ SkColor Tween::ColorValueBetween(double value, SkColor start, SkColor target) {
return SkColorSetARGB(0, 0, 0, 0);
blended_a = std::min(blended_a, 1.f);
- uint8 blended_r = BlendColorComponents(SkColorGetR(start),
- SkColorGetR(target),
- start_a,
- target_a,
- blended_a,
- value);
- uint8 blended_g = BlendColorComponents(SkColorGetG(start),
- SkColorGetG(target),
- start_a,
- target_a,
- blended_a,
- value);
- uint8 blended_b = BlendColorComponents(SkColorGetB(start),
- SkColorGetB(target),
- start_a,
- target_a,
- blended_a,
- value);
+ uint8_t blended_r =
+ BlendColorComponents(SkColorGetR(start), SkColorGetR(target), start_a,
+ target_a, blended_a, value);
+ uint8_t blended_g =
+ BlendColorComponents(SkColorGetG(start), SkColorGetG(target), start_a,
+ target_a, blended_a, value);
+ uint8_t blended_b =
+ BlendColorComponents(SkColorGetB(start), SkColorGetB(target), start_a,
+ target_a, blended_a, value);
return SkColorSetARGB(
FloatToColorByte(blended_a), blended_r, blended_g, blended_b);
« no previous file with comments | « ui/gfx/animation/tween.h ('k') | ui/gfx/animation/tween_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698