| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/ui_elements.h" | 5 #include "chrome/browser/android/vr_shell/ui_element.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "chrome/browser/android/vr_shell/animation.h" | 11 #include "chrome/browser/android/vr_shell/animation.h" |
| 12 #include "chrome/browser/android/vr_shell/easing.h" | 12 #include "chrome/browser/android/vr_shell/easing.h" |
| 13 #include "device/vr/vr_math.h" | 13 #include "device/vr/vr_math.h" |
| 14 | 14 |
| 15 namespace vr_shell { | 15 namespace vr_shell { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return vr::MatrixVectorRotate(transform_.to_world, kNormalOrig); | 94 return vr::MatrixVectorRotate(transform_.to_world, kNormalOrig); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool WorldRectangle::GetRayDistance(const gfx::Point3F& ray_origin, | 97 bool WorldRectangle::GetRayDistance(const gfx::Point3F& ray_origin, |
| 98 const gfx::Vector3dF& ray_vector, | 98 const gfx::Vector3dF& ray_vector, |
| 99 float* distance) const { | 99 float* distance) const { |
| 100 return GetRayPlaneDistance(ray_origin, ray_vector, GetCenter(), GetNormal(), | 100 return GetRayPlaneDistance(ray_origin, ray_vector, GetCenter(), GetNormal(), |
| 101 distance); | 101 distance); |
| 102 } | 102 } |
| 103 | 103 |
| 104 ContentRectangle::ContentRectangle() = default; | 104 UiElement::UiElement() = default; |
| 105 | 105 |
| 106 ContentRectangle::~ContentRectangle() = default; | 106 UiElement::~UiElement() = default; |
| 107 | 107 |
| 108 void ContentRectangle::Animate(const base::TimeTicks& time) { | 108 void UiElement::Animate(const base::TimeTicks& time) { |
| 109 for (auto& it : animations) { | 109 for (auto& it : animations) { |
| 110 Animation& animation = *it; | 110 Animation& animation = *it; |
| 111 if (time < animation.start) | 111 if (time < animation.start) |
| 112 continue; | 112 continue; |
| 113 | 113 |
| 114 // If |from| is not specified, start at the current values. | 114 // If |from| is not specified, start at the current values. |
| 115 if (animation.from.size() == 0) { | 115 if (animation.from.size() == 0) { |
| 116 switch (animation.property) { | 116 switch (animation.property) { |
| 117 case Animation::COPYRECT: | 117 case Animation::COPYRECT: |
| 118 animation.from.push_back(copy_rect.x()); | 118 animation.from.push_back(copy_rect.x()); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 for (auto it = animations.begin(); it != animations.end();) { | 194 for (auto it = animations.begin(); it != animations.end();) { |
| 195 const Animation& animation = **it; | 195 const Animation& animation = **it; |
| 196 if (time >= (animation.start + animation.duration)) { | 196 if (time >= (animation.start + animation.duration)) { |
| 197 it = animations.erase(it); | 197 it = animations.erase(it); |
| 198 } else { | 198 } else { |
| 199 ++it; | 199 ++it; |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool ContentRectangle::IsVisible() const { | 204 bool UiElement::IsVisible() const { |
| 205 return visible && computed_opacity > 0.0f; | 205 return visible && computed_opacity > 0.0f; |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool ContentRectangle::IsHitTestable() const { | 208 bool UiElement::IsHitTestable() const { |
| 209 return IsVisible() && hit_testable; | 209 return IsVisible() && hit_testable; |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace vr_shell | 212 } // namespace vr_shell |
| OLD | NEW |