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

Unified Diff: chrome/browser/android/vr_shell/ui_scene.cc

Issue 2966793002: NOT FOR REVIEW - convert to cc animation
Patch Set: switch to transform operations Created 3 years, 6 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 | « chrome/browser/android/vr_shell/ui_scene.h ('k') | chrome/browser/android/vr_shell/ui_scene_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/ui_scene.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene.cc b/chrome/browser/android/vr_shell/ui_scene.cc
index 5956b75702bcf9547edb7e4a1be0b8b78c76bf69..c4ad531a90a68c1bb7231ef213f727bcd14deed5 100644
--- a/chrome/browser/android/vr_shell/ui_scene.cc
+++ b/chrome/browser/android/vr_shell/ui_scene.cc
@@ -10,8 +10,7 @@
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "base/values.h"
-#include "chrome/browser/android/vr_shell/animation.h"
-#include "chrome/browser/android/vr_shell/easing.h"
+#include "cc/animation/animation_player.h"
#include "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
namespace vr_shell {
@@ -79,26 +78,14 @@ void UiScene::RemoveUiElement(int element_id) {
}
void UiScene::AddAnimation(int element_id,
- std::unique_ptr<Animation> animation) {
+ std::unique_ptr<cc::Animation> animation) {
UiElement* element = GetUiElementById(element_id);
- CHECK_NE(element, nullptr);
- for (const std::unique_ptr<Animation>& existing : element->animations()) {
- CHECK_NE(existing->id, animation->id);
- }
- element->animations().emplace_back(std::move(animation));
+ element->animation_player().AddAnimation(std::move(animation));
}
void UiScene::RemoveAnimation(int element_id, int animation_id) {
UiElement* element = GetUiElementById(element_id);
- CHECK_NE(element, nullptr);
- auto& animations = element->animations();
- for (auto it = animations.begin(); it != animations.end(); ++it) {
- const Animation& existing_animation = **it;
- if (existing_animation.id == animation_id) {
- animations.erase(it);
- return;
- }
- }
+ element->animation_player().RemoveAnimation(animation_id);
}
void UiScene::OnBeginFrame(const base::TimeTicks& current_time) {
@@ -247,13 +234,8 @@ void UiScene::ApplyRecursiveTransforms(UiElement* element) {
// Compute an inheritable transformation that can be applied to this element,
// and it's children, if applicable.
- gfx::Transform inheritable;
- inheritable.matrix().postScale(element->scale().x(), element->scale().y(),
- element->scale().z());
- inheritable.ConcatTransform(gfx::Transform(element->rotation()));
- inheritable.matrix().postTranslate(element->translation().x(),
- element->translation().y(),
- element->translation().z());
+ gfx::Transform inheritable = element->transform_operations().Apply();
+
if (parent) {
ApplyAnchoring(*parent, element->x_anchoring(), element->y_anchoring(),
&inheritable);
@@ -265,9 +247,8 @@ void UiScene::ApplyRecursiveTransforms(UiElement* element) {
element->set_computed_lock_to_fov(parent->lock_to_fov());
}
- transform.ConcatTransform(inheritable);
-
- element->set_transform(transform);
+ // transform.ConcatTransform(inheritable);
+ element->set_screen_space_transform(transform * inheritable);
element->set_inheritable_transform(inheritable);
element->set_dirty(false);
}
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene.h ('k') | chrome/browser/android/vr_shell/ui_scene_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698