Chromium Code Reviews| 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 2d4adb13181229d86665b66925900a5b649193b6..3186ee634a23c4ed78232f99c5d1cba23cf448af 100644 |
| --- a/chrome/browser/android/vr_shell/ui_scene.cc |
| +++ b/chrome/browser/android/vr_shell/ui_scene.cc |
| @@ -96,6 +96,9 @@ void ParseEndpointToFloats(Animation::Property property, |
| case Animation::Property::TRANSLATION: |
| ParseFloats(dict, {"x", "y", "z"}, vec); |
| break; |
| + case Animation::Property::OPACITY: |
| + ParseFloats(dict, {"x"}, vec); |
| + break; |
| } |
| } |
| @@ -324,7 +327,9 @@ void UiScene::UpdateTransforms(float screen_tilt, int64_t time_in_micro) { |
| for (auto& element : ui_elements_) { |
| element->transform.MakeIdentity(); |
| element->transform.Scale(element->size.x, element->size.y, element->size.z); |
| - ApplyRecursiveTransforms(*element.get(), &element->transform); |
| + element->computed_opacity = 1.0f; |
| + ApplyRecursiveTransforms(*element.get(), &element->transform, |
| + &element->computed_opacity); |
| element->transform.Rotate(1.0f, 0.0f, 0.0f, screen_tilt); |
| } |
| } |
| @@ -352,19 +357,21 @@ UiScene::UiScene() = default; |
| UiScene::~UiScene() = default; |
| void UiScene::ApplyRecursiveTransforms(const ContentRectangle& element, |
|
mthiesse
2017/01/11 18:33:04
Unrelated, but can you add a TODO to be smarter ab
cjgrant
2017/01/11 18:53:07
Agreed. There are multiple bits to this though:
1
mthiesse
2017/01/11 19:02:49
Speaking as someone who's never had children, a di
cjgrant
2017/01/11 20:58:42
Done. Filed crbug/680253.
|
| - ReversibleTransform* transform) { |
| + ReversibleTransform* transform, |
| + float *opacity) { |
|
mthiesse
2017/01/11 18:33:04
float*
cjgrant
2017/01/11 20:58:42
Done.
|
| transform->Scale(element.scale.x, element.scale.y, element.scale.z); |
| transform->Rotate(element.rotation.x, element.rotation.y, |
| element.rotation.z, element.rotation.angle); |
| transform->Translate(element.translation.x, element.translation.y, |
| element.translation.z); |
| + *opacity *= element.opacity; |
| if (element.parent_id >= 0) { |
| const ContentRectangle* parent = GetUiElementById(element.parent_id); |
| CHECK(parent != nullptr); |
| ApplyAnchoring(*parent, element.x_anchoring, element.y_anchoring, |
| transform); |
| - ApplyRecursiveTransforms(*parent, transform); |
| + ApplyRecursiveTransforms(*parent, transform, opacity); |
| } |
| } |
| @@ -385,6 +392,10 @@ void UiScene::ApplyDictToElement(const base::DictionaryValue& dict, |
| ParseVec3f(dict, "scale", &element->scale); |
| ParseRotationAxisAngle(dict, "rotation", &element->rotation); |
| ParseVec3f(dict, "translation", &element->translation); |
| + double opacity; |
| + if (dict.GetDouble("opacity", &opacity)) { |
| + element->opacity = opacity; |
| + } |
| if (dict.GetBoolean("contentQuad", &element->content_quad)) { |
| if (element->content_quad) { |