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 @@
namespace vr_shell {
VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent)
: background_color_(SK_ColorWHITE), transparent_(transparent) {
VrCompositor::VrCompositor(ui::WindowAndroid* window) {
compositor_.reset(content::Compositor::Create(this, window));
compositor_->SetHasTransparentBackground(transparent);
}
VrCompositor::~VrCompositor() {
......@@ -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
// its previous parent on teardown.
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();
compositor_->SetRootLayer(layer_);
}
void VrCompositor::RestoreLayer() {
if (!layer_)
return;
layer_->SetBackgroundColor(background_color_);
if (layer_parent_) {
if (layer_ && layer_parent_)
layer_parent_->AddChild(layer_);
}
layer_ = nullptr;
layer_parent_ = nullptr;
}
void VrCompositor::SurfaceDestroyed() {
......
......@@ -31,7 +31,7 @@ namespace vr_shell {
class VrCompositor : public content::CompositorClient {
public:
VrCompositor(ui::WindowAndroid* window, bool is_transparent);
explicit VrCompositor(ui::WindowAndroid* window);
~VrCompositor() override;
void SurfaceDestroyed();
......@@ -46,8 +46,6 @@ class VrCompositor : public content::CompositorClient {
cc::Layer* layer_ = nullptr;
cc::Layer* layer_parent_ = nullptr;
SkColor background_color_;
bool transparent_;
DISALLOW_COPY_AND_ASSIGN(VrCompositor);
};
......
......@@ -88,7 +88,7 @@ VrShell::VrShell(JNIEnv* env,
bool reprojected_rendering)
: vr_shell_enabled_(base::FeatureList::IsEnabled(features::kVrShell)),
window_(window),
compositor_(base::MakeUnique<VrCompositor>(window_, false)),
compositor_(base::MakeUnique<VrCompositor>(window_)),
delegate_provider_(delegate),
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
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