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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
11 #include "content/public/browser/android/compositor.h" | 11 #include "content/public/browser/android/compositor.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
14 #include "ui/android/window_android.h" | 14 #include "ui/android/window_android.h" |
15 | 15 |
16 namespace vr_shell { | 16 namespace vr_shell { |
17 | 17 |
18 VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent) | 18 VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent) |
19 : background_color_(SK_ColorWHITE), transparent_(transparent) { | 19 : background_color_(SK_ColorWHITE), transparent_(transparent) { |
20 compositor_.reset(content::Compositor::Create(this, window)); | 20 compositor_.reset(content::Compositor::Create(this, window)); |
21 compositor_->SetHasTransparentBackground(transparent); | 21 compositor_->SetHasTransparentBackground(transparent); |
22 } | 22 } |
23 | 23 |
24 VrCompositor::~VrCompositor() { | 24 VrCompositor::~VrCompositor() { |
25 RestoreLayer(); | 25 RestoreLayer(); |
26 } | 26 } |
27 | 27 |
28 void VrCompositor::UpdateLayerTreeHost() {} | |
29 | |
30 void VrCompositor::OnSwapBuffersCompleted(int pending_swap_buffers) {} | |
31 | |
32 void VrCompositor::SetLayer(content::WebContents* web_contents) { | 28 void VrCompositor::SetLayer(content::WebContents* web_contents) { |
33 RestoreLayer(); | 29 RestoreLayer(); |
34 if (!web_contents) { | 30 if (!web_contents) { |
35 scoped_refptr<cc::SolidColorLayer> layer = cc::SolidColorLayer::Create(); | 31 scoped_refptr<cc::SolidColorLayer> layer = cc::SolidColorLayer::Create(); |
36 layer->SetBackgroundColor(SK_ColorTRANSPARENT); | 32 layer->SetBackgroundColor(SK_ColorTRANSPARENT); |
37 compositor_->SetRootLayer(std::move(layer)); | 33 compositor_->SetRootLayer(std::move(layer)); |
38 return; | 34 return; |
39 } | 35 } |
40 ui::ViewAndroid* view_android = web_contents->GetNativeView(); | 36 ui::ViewAndroid* view_android = web_contents->GetNativeView(); |
41 | 37 |
(...skipping 27 matching lines...) Expand all Loading... |
69 | 65 |
70 void VrCompositor::SetWindowBounds(gfx::Size size) { | 66 void VrCompositor::SetWindowBounds(gfx::Size size) { |
71 compositor_->SetWindowBounds(size); | 67 compositor_->SetWindowBounds(size); |
72 } | 68 } |
73 | 69 |
74 void VrCompositor::SurfaceChanged(jobject surface) { | 70 void VrCompositor::SurfaceChanged(jobject surface) { |
75 compositor_->SetSurface(surface); | 71 compositor_->SetSurface(surface); |
76 } | 72 } |
77 | 73 |
78 } // namespace vr_shell | 74 } // namespace vr_shell |
OLD | NEW |