| 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/window_android.h" |
| 12 | 12 |
| 13 using base::android::JavaParamRef; | |
| 14 | |
| 15 namespace vr_shell { | 13 namespace vr_shell { |
| 16 | 14 |
| 17 VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent) | 15 VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent) |
| 18 : background_color_(SK_ColorWHITE), | 16 : background_color_(SK_ColorWHITE), |
| 19 transparent_(transparent) { | 17 transparent_(transparent) { |
| 20 compositor_.reset(content::Compositor::Create(this, window)); | 18 compositor_.reset(content::Compositor::Create(this, window)); |
| 21 compositor_->SetHasTransparentBackground(transparent); | 19 compositor_->SetHasTransparentBackground(transparent); |
| 22 } | 20 } |
| 23 | 21 |
| 24 VrCompositor::~VrCompositor() { | 22 VrCompositor::~VrCompositor() { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 53 } | 51 } |
| 54 | 52 |
| 55 void VrCompositor::SurfaceDestroyed() { | 53 void VrCompositor::SurfaceDestroyed() { |
| 56 compositor_->SetSurface(nullptr); | 54 compositor_->SetSurface(nullptr); |
| 57 } | 55 } |
| 58 | 56 |
| 59 void VrCompositor::SetWindowBounds(int width, int height) { | 57 void VrCompositor::SetWindowBounds(int width, int height) { |
| 60 compositor_->SetWindowBounds(gfx::Size(width, height)); | 58 compositor_->SetWindowBounds(gfx::Size(width, height)); |
| 61 } | 59 } |
| 62 | 60 |
| 63 void VrCompositor::SurfaceChanged(const JavaParamRef<jobject>& surface) { | 61 void VrCompositor::SurfaceChanged(jobject surface) { |
| 64 DCHECK(surface); | 62 DCHECK(surface); |
| 65 compositor_->SetSurface(surface); | 63 compositor_->SetSurface(surface); |
| 66 } | 64 } |
| 67 | 65 |
| 68 } // namespace vr_shell | 66 } // namespace vr_shell |
| OLD | NEW |