Skip to content

Commit

Permalink
Switch to standard integer types in ui/gfx/.
Browse files Browse the repository at this point in the history
BUG=138542
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/1543183002

Cr-Commit-Position: refs/heads/master@{#366731}
  • Loading branch information
avi authored and Commit bot committed Dec 23, 2015
1 parent 5226870 commit c89eb8d
Show file tree
Hide file tree
Showing 193 changed files with 595 additions and 314 deletions.
2 changes: 1 addition & 1 deletion ui/gfx/android/device_display_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <jni.h>
#include <string>

#include "base/basictypes.h"
#include "base/macros.h"
#include "ui/gfx/gfx_export.h"

namespace gfx {
Expand Down
1 change: 1 addition & 0 deletions ui/gfx/android/gfx_jni_registrar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/macros.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/android/shared_device_display_info.h"
#include "ui/gfx/android/view_configuration.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/gfx/android/java_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#define UI_GFX_ANDROID_JAVA_BITMAP_H_

#include <jni.h>
#include <stdint.h>

#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"

Expand Down
2 changes: 1 addition & 1 deletion ui/gfx/android/shared_device_display_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_

#include "base/android/scoped_java_ref.h"
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"

Expand Down
1 change: 1 addition & 0 deletions ui/gfx/android/view_configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/android/context_utils.h"
#include "base/android/jni_android.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/threading/non_thread_safe.h"
#include "jni/ViewConfigurationHelper_jni.h"

Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/animation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "ui/gfx/animation/animation.h"

#include "build/build_config.h"
#include "ui/gfx/animation/animation_container.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/tween.h"
Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define UI_GFX_ANIMATION_ANIMATION_H_

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "ui/gfx/animation/animation_container_element.h"
Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/animation_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <set>

#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/animation_container_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "ui/gfx/animation/animation_container.h"

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/animation/animation_container_observer.h"
Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/animation_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/linear_animation.h"
Expand Down
3 changes: 2 additions & 1 deletion ui/gfx/animation/linear_animation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ui/gfx/animation/linear_animation.h"

#include <math.h>
#include <stdint.h>

#include <algorithm>

Expand Down Expand Up @@ -50,7 +51,7 @@ double LinearAnimation::GetCurrentValue() const {
void LinearAnimation::SetCurrentValue(double new_value) {
new_value = std::max(0.0, std::min(1.0, new_value));
base::TimeDelta time_delta = base::TimeDelta::FromMicroseconds(
static_cast<int64>(duration_.InMicroseconds() * (new_value - state_)));
static_cast<int64_t>(duration_.InMicroseconds() * (new_value - state_)));
SetStartTime(start_time() - time_delta);
state_ = new_value;
}
Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/linear_animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef UI_GFX_ANIMATION_LINEAR_ANIMATION_H_
#define UI_GFX_ANIMATION_LINEAR_ANIMATION_H_

#include "base/macros.h"
#include "base/time/time.h"
#include "ui/gfx/animation/animation.h"

Expand Down
3 changes: 3 additions & 0 deletions ui/gfx/animation/multi_animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
#ifndef UI_GFX_ANIMATION_MULTI_ANIMATION_H_
#define UI_GFX_ANIMATION_MULTI_ANIMATION_H_

#include <stddef.h>

#include <vector>

#include "base/macros.h"
#include "ui/gfx/animation/animation.h"
#include "ui/gfx/animation/tween.h"

Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/slide_animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef UI_GFX_ANIMATION_SLIDE_ANIMATION_H_
#define UI_GFX_ANIMATION_SLIDE_ANIMATION_H_

#include "base/macros.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/animation/tween.h"

Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/slide_animation_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "ui/gfx/animation/slide_animation.h"

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/test_animation_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef UI_GFX_ANIMATION_TEST_ANIMATION_DELEGATE_H_
#define UI_GFX_ANIMATION_TEST_ANIMATION_DELEGATE_H_

#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "ui/gfx/animation/animation_delegate.h"

Expand Down
1 change: 1 addition & 0 deletions ui/gfx/animation/throb_animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef UI_GFX_ANIMATION_THROB_ANIMATION_H_
#define UI_GFX_ANIMATION_THROB_ANIMATION_H_

#include "base/macros.h"
#include "ui/gfx/animation/slide_animation.h"

namespace gfx {
Expand Down
54 changes: 23 additions & 31 deletions ui/gfx/animation/tween.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ui/gfx/animation/tween.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef UI_GFX_ANIMATION_TWEEN_H_
#define UI_GFX_ANIMATION_TWEEN_H_

#include "base/basictypes.h"
#include "base/macros.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/gfx_export.h"
Expand Down
7 changes: 4 additions & 3 deletions ui/gfx/animation/tween_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

#include <math.h>

#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/test/gfx_util.h"

#if defined(OS_WIN)
#include <float.h>
#endif

#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/test/gfx_util.h"

namespace gfx {
namespace {

Expand Down
2 changes: 2 additions & 0 deletions ui/gfx/blit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ui/gfx/blit.h"

#include <stddef.h>

#include "base/logging.h"
#include "build/build_config.h"
#include "skia/ext/platform_canvas.h"
Expand Down
Loading

0 comments on commit c89eb8d

Please sign in to comment.