| 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/vr_compositor.h" | 5 #include "chrome/browser/android/vr_shell/vr_compositor.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "content/public/browser/android/compositor.h" | 8 #include "content/public/browser/android/compositor.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "ui/android/window_android.h" | 11 #include "ui/android/view_android.h" |
| 12 | 12 |
| 13 namespace vr_shell { | 13 namespace vr_shell { |
| 14 | 14 |
| 15 VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent) | 15 VrCompositor::VrCompositor(ui::ViewRoot* view_root, bool transparent) |
| 16 : background_color_(SK_ColorWHITE), | 16 : background_color_(SK_ColorWHITE), |
| 17 transparent_(transparent) { | 17 transparent_(transparent) { |
| 18 compositor_.reset(content::Compositor::Create(this, window)); | 18 compositor_.reset(content::Compositor::Create(this, view_root)); |
| 19 compositor_->SetHasTransparentBackground(transparent); | 19 compositor_->SetHasTransparentBackground(transparent); |
| 20 } | 20 } |
| 21 | 21 |
| 22 VrCompositor::~VrCompositor() { | 22 VrCompositor::~VrCompositor() { |
| 23 if (layer_) { | 23 if (layer_) { |
| 24 layer_->SetBackgroundColor(background_color_); | 24 layer_->SetBackgroundColor(background_color_); |
| 25 if (layer_parent_) { | 25 if (layer_parent_) { |
| 26 layer_parent_->AddChild(layer_); | 26 layer_parent_->AddChild(layer_); |
| 27 } | 27 } |
| 28 } | 28 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 bounds_ = size; | 58 bounds_ = size; |
| 59 compositor_->SetWindowBounds(bounds_); | 59 compositor_->SetWindowBounds(bounds_); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void VrCompositor::SurfaceChanged(jobject surface) { | 62 void VrCompositor::SurfaceChanged(jobject surface) { |
| 63 DCHECK(surface); | 63 DCHECK(surface); |
| 64 compositor_->SetSurface(surface); | 64 compositor_->SetSurface(surface); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace vr_shell | 67 } // namespace vr_shell |
| OLD | NEW |