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_shell_gl.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_gl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
927 if (ready_to_draw_) { | 927 if (ready_to_draw_) { |
928 draw_task_.Reset(base::Bind(&VrShellGl::DrawFrame, base::Unretained(this))); | 928 draw_task_.Reset(base::Bind(&VrShellGl::DrawFrame, base::Unretained(this))); |
929 ScheduleNextDrawFrame(); | 929 ScheduleNextDrawFrame(); |
930 } | 930 } |
931 } | 931 } |
932 | 932 |
933 void VrShellGl::SetWebVrMode(bool enabled) { | 933 void VrShellGl::SetWebVrMode(bool enabled) { |
934 web_vr_mode_ = enabled; | 934 web_vr_mode_ = enabled; |
935 } | 935 } |
936 | 936 |
937 void VrShellGl::UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, | 937 void VrShellGl::UpdateWebVRTextureBounds(uint32_t frame_index, |
938 const gvr::Rectf& left_bounds, | |
938 const gvr::Rectf& right_bounds) { | 939 const gvr::Rectf& right_bounds) { |
940 // TODO(klausw): Only update the texture bounds once we're rendering frame | |
941 // |for_frame_index|. | |
dcheng
2017/01/10 06:53:19
Sorry for missing this in my review queue. Is ther
| |
939 webvr_left_viewport_->SetSourceUv(left_bounds); | 942 webvr_left_viewport_->SetSourceUv(left_bounds); |
940 webvr_right_viewport_->SetSourceUv(right_bounds); | 943 webvr_right_viewport_->SetSourceUv(right_bounds); |
941 } | 944 } |
942 | 945 |
943 gvr::GvrApi* VrShellGl::gvr_api() { | 946 gvr::GvrApi* VrShellGl::gvr_api() { |
944 return gvr_api_.get(); | 947 return gvr_api_.get(); |
945 } | 948 } |
946 | 949 |
947 void VrShellGl::ContentBoundsChanged(int width, int height) { | 950 void VrShellGl::ContentBoundsChanged(int width, int height) { |
948 TRACE_EVENT0("gpu", "VrShellGl::ContentBoundsChanged"); | 951 TRACE_EVENT0("gpu", "VrShellGl::ContentBoundsChanged"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 void VrShellGl::ForceExitVr() { | 1000 void VrShellGl::ForceExitVr() { |
998 main_thread_task_runner_->PostTask( | 1001 main_thread_task_runner_->PostTask( |
999 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_)); | 1002 FROM_HERE, base::Bind(&VrShell::ForceExitVr, weak_vr_shell_)); |
1000 } | 1003 } |
1001 | 1004 |
1002 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) { | 1005 void VrShellGl::UpdateScene(std::unique_ptr<base::ListValue> commands) { |
1003 scene_->HandleCommands(std::move(commands), TimeInMicroseconds()); | 1006 scene_->HandleCommands(std::move(commands), TimeInMicroseconds()); |
1004 } | 1007 } |
1005 | 1008 |
1006 } // namespace vr_shell | 1009 } // namespace vr_shell |
OLD | NEW |