Commit eacfd594 authored by mthiesse's avatar mthiesse Committed by Commit bot

VR: Remove unnecessary transparency support from VR compositor.

Just a cleanup patch, no change in functionality.

BUG=

Review-Url: https://codereview.chromium.org/2843993002
Cr-Commit-Position: refs/heads/master@{#467702}
parent 8f565654
...@@ -15,10 +15,8 @@ ...@@ -15,10 +15,8 @@
namespace vr_shell { namespace vr_shell {
VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent) VrCompositor::VrCompositor(ui::WindowAndroid* window) {
: background_color_(SK_ColorWHITE), transparent_(transparent) {
compositor_.reset(content::Compositor::Create(this, window)); compositor_.reset(content::Compositor::Create(this, window));
compositor_->SetHasTransparentBackground(transparent);
} }
VrCompositor::~VrCompositor() { VrCompositor::~VrCompositor() {
...@@ -39,24 +37,15 @@ void VrCompositor::SetLayer(content::WebContents* web_contents) { ...@@ -39,24 +37,15 @@ void VrCompositor::SetLayer(content::WebContents* web_contents) {
// removing it from its previous parent, so we remember that and restore it to // removing it from its previous parent, so we remember that and restore it to
// its previous parent on teardown. // its previous parent on teardown.
layer_ = view_android->GetLayer(); layer_ = view_android->GetLayer();
// Remember the old background color to be restored later.
background_color_ = layer_->background_color();
if (transparent_) {
layer_->SetBackgroundColor(SK_ColorTRANSPARENT);
}
layer_parent_ = layer_->parent(); layer_parent_ = layer_->parent();
compositor_->SetRootLayer(layer_); compositor_->SetRootLayer(layer_);
} }
void VrCompositor::RestoreLayer() { void VrCompositor::RestoreLayer() {
if (!layer_) if (layer_ && layer_parent_)
return;
layer_->SetBackgroundColor(background_color_);
if (layer_parent_) {
layer_parent_->AddChild(layer_); layer_parent_->AddChild(layer_);
}
layer_ = nullptr; layer_ = nullptr;
layer_parent_ = nullptr;
} }
void VrCompositor::SurfaceDestroyed() { void VrCompositor::SurfaceDestroyed() {
......
...@@ -31,7 +31,7 @@ namespace vr_shell { ...@@ -31,7 +31,7 @@ namespace vr_shell {
class VrCompositor : public content::CompositorClient { class VrCompositor : public content::CompositorClient {
public: public:
VrCompositor(ui::WindowAndroid* window, bool is_transparent); explicit VrCompositor(ui::WindowAndroid* window);
~VrCompositor() override; ~VrCompositor() override;
void SurfaceDestroyed(); void SurfaceDestroyed();
...@@ -46,8 +46,6 @@ class VrCompositor : public content::CompositorClient { ...@@ -46,8 +46,6 @@ class VrCompositor : public content::CompositorClient {
cc::Layer* layer_ = nullptr; cc::Layer* layer_ = nullptr;
cc::Layer* layer_parent_ = nullptr; cc::Layer* layer_parent_ = nullptr;
SkColor background_color_;
bool transparent_;
DISALLOW_COPY_AND_ASSIGN(VrCompositor); DISALLOW_COPY_AND_ASSIGN(VrCompositor);
}; };
......
...@@ -88,7 +88,7 @@ VrShell::VrShell(JNIEnv* env, ...@@ -88,7 +88,7 @@ VrShell::VrShell(JNIEnv* env,
bool reprojected_rendering) bool reprojected_rendering)
: vr_shell_enabled_(base::FeatureList::IsEnabled(features::kVrShell)), : vr_shell_enabled_(base::FeatureList::IsEnabled(features::kVrShell)),
window_(window), window_(window),
compositor_(base::MakeUnique<VrCompositor>(window_, false)), compositor_(base::MakeUnique<VrCompositor>(window_)),
delegate_provider_(delegate), delegate_provider_(delegate),
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
reprojected_rendering_(reprojected_rendering), reprojected_rendering_(reprojected_rendering),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment