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.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "chrome/browser/android/vr_shell/ui_elements.h" | 8 #include "chrome/browser/android/vr_shell/ui_elements.h" |
9 #include "chrome/browser/android/vr_shell/ui_interface.h" | 9 #include "chrome/browser/android/vr_shell/ui_interface.h" |
10 #include "chrome/browser/android/vr_shell/ui_scene.h" | 10 #include "chrome/browser/android/vr_shell/ui_scene.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 using base::android::JavaParamRef; | 32 using base::android::JavaParamRef; |
33 | 33 |
34 namespace { | 34 namespace { |
35 // Constant taken from treasure_hunt demo. | 35 // Constant taken from treasure_hunt demo. |
36 static constexpr long kPredictionTimeWithoutVsyncNanos = 50000000; | 36 static constexpr long kPredictionTimeWithoutVsyncNanos = 50000000; |
37 | 37 |
38 static constexpr float kZNear = 0.1f; | 38 static constexpr float kZNear = 0.1f; |
39 static constexpr float kZFar = 1000.0f; | 39 static constexpr float kZFar = 1000.0f; |
40 | 40 |
41 static constexpr gvr::Vec3f kDesktopPositionDefault = {0.0f, 0.0f, -2.0f}; | |
42 static constexpr float kDesktopHeightDefault = 1.6f; | |
43 | |
44 // Screen angle in degrees. 0 = vertical, positive = top closer. | 41 // Screen angle in degrees. 0 = vertical, positive = top closer. |
45 static constexpr float kDesktopScreenTiltDefault = 0; | 42 static constexpr float kDesktopScreenTiltDefault = 0; |
46 | 43 |
47 static constexpr float kScreenHeightRatio = 1.0f; | |
48 static constexpr float kScreenWidthRatio = 16.0f / 9.0f; | |
49 | |
50 static constexpr float kReticleWidth = 0.025f; | 44 static constexpr float kReticleWidth = 0.025f; |
51 static constexpr float kReticleHeight = 0.025f; | 45 static constexpr float kReticleHeight = 0.025f; |
52 | 46 |
53 static constexpr float kLaserWidth = 0.01f; | 47 static constexpr float kLaserWidth = 0.01f; |
54 | 48 |
55 // Angle (radians) the beam down from the controller axis, for wrist comfort. | 49 // Angle (radians) the beam down from the controller axis, for wrist comfort. |
56 static constexpr float kErgoAngleOffset = 0.26f; | 50 static constexpr float kErgoAngleOffset = 0.26f; |
57 | 51 |
58 static constexpr gvr::Vec3f kOrigin = {0.0f, 0.0f, 0.0f}; | 52 static constexpr gvr::Vec3f kOrigin = {0.0f, 0.0f, 0.0f}; |
59 | 53 |
60 // In lieu of an elbow model, we assume a position for the user's hand. | 54 // In lieu of an elbow model, we assume a position for the user's hand. |
61 // TODO(mthiesse): Handedness options. | 55 // TODO(mthiesse): Handedness options. |
62 static constexpr gvr::Vec3f kHandPosition = {0.2f, -0.5f, -0.2f}; | 56 static constexpr gvr::Vec3f kHandPosition = {0.2f, -0.5f, -0.2f}; |
63 | 57 |
| 58 // If there is no content quad, and the reticle isn't hitting another element, |
| 59 // draw the reticle at this distance. |
| 60 static constexpr float kDefaultReticleDistance = 2.0f; |
| 61 |
64 // Fraction of the distance to the object the cursor is drawn at to avoid | 62 // Fraction of the distance to the object the cursor is drawn at to avoid |
65 // rounding errors drawing the cursor behind the object. | 63 // rounding errors drawing the cursor behind the object. |
66 static constexpr float kReticleOffset = 0.99f; | 64 static constexpr float kReticleOffset = 0.99f; |
67 | 65 |
68 // Limit the rendering distance of the reticle to the distance to a corner of | 66 // Limit the rendering distance of the reticle to the distance to a corner of |
69 // the content quad, times this value. This lets the rendering distance | 67 // the content quad, times this value. This lets the rendering distance |
70 // adjust according to content quad placement. | 68 // adjust according to content quad placement. |
71 static constexpr float kReticleDistanceMultiplier = 1.5f; | 69 static constexpr float kReticleDistanceMultiplier = 1.5f; |
72 | 70 |
73 // UI element 0 is the browser content rectangle. | |
74 static constexpr int kBrowserUiElementId = 0; | |
75 | |
76 static constexpr int kFramePrimaryBuffer = 0; | 71 static constexpr int kFramePrimaryBuffer = 0; |
77 static constexpr int kFrameHeadlockedBuffer = 1; | 72 static constexpr int kFrameHeadlockedBuffer = 1; |
78 | 73 |
79 vr_shell::VrShell* g_instance; | 74 vr_shell::VrShell* g_instance; |
80 | 75 |
81 static const char kVrShellUIURL[] = "chrome://vr-shell-ui"; | 76 static const char kVrShellUIURL[] = "chrome://vr-shell-ui"; |
82 | 77 |
83 float Distance(const gvr::Vec3f& vec1, const gvr::Vec3f& vec2) { | 78 float Distance(const gvr::Vec3f& vec1, const gvr::Vec3f& vec2) { |
84 float xdiff = (vec1.x - vec2.x); | 79 float xdiff = (vec1.x - vec2.x); |
85 float ydiff = (vec1.y - vec2.y); | 80 float ydiff = (vec1.y - vec2.y); |
(...skipping 27 matching lines...) Expand all Loading... |
113 | 108 |
114 } // namespace | 109 } // namespace |
115 | 110 |
116 namespace vr_shell { | 111 namespace vr_shell { |
117 | 112 |
118 VrShell::VrShell(JNIEnv* env, jobject obj, | 113 VrShell::VrShell(JNIEnv* env, jobject obj, |
119 content::WebContents* main_contents, | 114 content::WebContents* main_contents, |
120 ui::WindowAndroid* content_window, | 115 ui::WindowAndroid* content_window, |
121 content::WebContents* ui_contents, | 116 content::WebContents* ui_contents, |
122 ui::WindowAndroid* ui_window) | 117 ui::WindowAndroid* ui_window) |
123 : desktop_screen_tilt_(kDesktopScreenTiltDefault), | 118 : main_contents_(main_contents), |
124 desktop_height_(kDesktopHeightDefault), | |
125 main_contents_(main_contents), | |
126 ui_contents_(ui_contents), | 119 ui_contents_(ui_contents), |
127 weak_ptr_factory_(this) { | 120 weak_ptr_factory_(this) { |
128 DCHECK(g_instance == nullptr); | 121 DCHECK(g_instance == nullptr); |
129 g_instance = this; | 122 g_instance = this; |
130 j_vr_shell_.Reset(env, obj); | 123 j_vr_shell_.Reset(env, obj); |
131 scene_.reset(new UiScene); | 124 scene_.reset(new UiScene); |
132 html_interface_.reset(new UiInterface); | 125 html_interface_.reset(new UiInterface); |
133 content_compositor_.reset(new VrCompositor(content_window, false)); | 126 content_compositor_.reset(new VrCompositor(content_window, false)); |
134 ui_compositor_.reset(new VrCompositor(ui_window, true)); | 127 ui_compositor_.reset(new VrCompositor(ui_window, true)); |
135 | 128 |
136 float screen_width = kScreenWidthRatio * desktop_height_; | |
137 float screen_height = kScreenHeightRatio * desktop_height_; | |
138 std::unique_ptr<ContentRectangle> rect(new ContentRectangle()); | |
139 rect->id = kBrowserUiElementId; | |
140 rect->size = {screen_width, screen_height, 1.0f}; | |
141 rect->translation = kDesktopPositionDefault; | |
142 scene_->AddUiElement(rect); | |
143 | |
144 LoadUIContent(); | 129 LoadUIContent(); |
145 | 130 |
146 gvr::Mat4f identity; | 131 gvr::Mat4f identity; |
147 SetIdentityM(identity); | 132 SetIdentityM(identity); |
148 webvr_head_pose_.resize(kPoseRingBufferSize, identity); | 133 webvr_head_pose_.resize(kPoseRingBufferSize, identity); |
149 } | 134 } |
150 | 135 |
151 void VrShell::UpdateCompositorLayers(JNIEnv* env, | 136 void VrShell::UpdateCompositorLayers(JNIEnv* env, |
152 const JavaParamRef<jobject>& obj) { | 137 const JavaParamRef<jobject>& obj) { |
153 content_compositor_->SetLayer(main_contents_); | 138 content_compositor_->SetLayer(main_contents_); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 controller_quat_ = GetRotationFromZAxis(forward_vector); | 267 controller_quat_ = GetRotationFromZAxis(forward_vector); |
283 } else { | 268 } else { |
284 ergo_neutral_pose = {0.0f, -sin(kErgoAngleOffset), -cos(kErgoAngleOffset)}; | 269 ergo_neutral_pose = {0.0f, -sin(kErgoAngleOffset), -cos(kErgoAngleOffset)}; |
285 controller_quat_ = controller_->Orientation(); | 270 controller_quat_ = controller_->Orientation(); |
286 } | 271 } |
287 | 272 |
288 gvr::Mat4f mat = QuatToMatrix(controller_quat_); | 273 gvr::Mat4f mat = QuatToMatrix(controller_quat_); |
289 gvr::Vec3f forward = MatrixVectorMul(mat, ergo_neutral_pose); | 274 gvr::Vec3f forward = MatrixVectorMul(mat, ergo_neutral_pose); |
290 gvr::Vec3f origin = kHandPosition; | 275 gvr::Vec3f origin = kHandPosition; |
291 | 276 |
292 target_element_ = nullptr; | |
293 | |
294 ContentRectangle* content_plane = | |
295 scene_->GetUiElementById(kBrowserUiElementId); | |
296 | |
297 float distance = content_plane->GetRayDistance(origin, forward); | |
298 | |
299 // If we place the reticle based on elements intersecting the controller beam, | 277 // If we place the reticle based on elements intersecting the controller beam, |
300 // we can end up with the reticle hiding behind elements, or jumping laterally | 278 // we can end up with the reticle hiding behind elements, or jumping laterally |
301 // in the field of view. This is physically correct, but hard to use. For | 279 // in the field of view. This is physically correct, but hard to use. For |
302 // usability, do the following instead: | 280 // usability, do the following instead: |
303 // | 281 // |
304 // - Project the controller laser onto an outer surface, which is the | 282 // - Project the controller laser onto an outer surface, which is the |
305 // closer of the desktop plane, or a distance-limiting sphere. | 283 // closer of the desktop plane, or a distance-limiting sphere. |
306 // - Create a vector between the eyes and the outer surface point. | 284 // - Create a vector between the eyes and the outer surface point. |
307 // - If any UI elements intersect this vector, choose the closest to the eyes, | 285 // - If any UI elements intersect this vector, choose the closest to the eyes, |
308 // and place the reticle at the intersection point. | 286 // and place the reticle at the intersection point. |
309 | 287 |
310 // Find distance to a corner of the content quad, and limit the cursor | 288 // Find distance to a corner of the content quad, and limit the cursor |
311 // distance to a multiple of that distance. This lets us keep the reticle on | 289 // distance to a multiple of that distance. This lets us keep the reticle on |
312 // the content plane near the content window, and on the surface of a sphere | 290 // the content plane near the content window, and on the surface of a sphere |
313 // in other directions. Note that this approach uses distance from controller, | 291 // in other directions. Note that this approach uses distance from controller, |
314 // rather than eye, for simplicity. This will make the sphere slightly | 292 // rather than eye, for simplicity. This will make the sphere slightly |
315 // off-center. | 293 // off-center. |
316 gvr::Vec3f corner = {0.5f, 0.5f, 0.0f}; | 294 float distance = kDefaultReticleDistance; |
317 corner = MatrixVectorMul(content_plane->transform.to_world, corner); | 295 ContentRectangle* content_plane = scene_->GetContentQuad(); |
318 float max_distance = Distance(origin, corner) * kReticleDistanceMultiplier; | 296 if (content_plane) { |
319 if (distance > max_distance || distance <= 0.0f) { | 297 distance = content_plane->GetRayDistance(origin, forward); |
320 distance = max_distance; | 298 gvr::Vec3f corner = {0.5f, 0.5f, 0.0f}; |
| 299 corner = MatrixVectorMul(content_plane->transform.to_world, corner); |
| 300 float max_distance = Distance(origin, corner) * kReticleDistanceMultiplier; |
| 301 if (distance > max_distance || distance <= 0.0f) { |
| 302 distance = max_distance; |
| 303 } |
321 } | 304 } |
| 305 |
322 target_point_ = GetRayPoint(origin, forward, distance); | 306 target_point_ = GetRayPoint(origin, forward, distance); |
323 gvr::Vec3f eye_to_target = target_point_; | 307 gvr::Vec3f eye_to_target = target_point_; |
324 NormalizeVector(eye_to_target); | 308 NormalizeVector(eye_to_target); |
325 | 309 |
326 // Determine which UI element (if any) intersects the line between the eyes | 310 // Determine which UI element (if any) intersects the line between the eyes |
327 // and the controller target position. | 311 // and the controller target position. |
328 float closest_element_distance = std::numeric_limits<float>::infinity(); | 312 float closest_element_distance = std::numeric_limits<float>::infinity(); |
329 int pixel_x = 0; | 313 int pixel_x = 0; |
330 int pixel_y = 0; | 314 int pixel_y = 0; |
| 315 target_element_ = nullptr; |
331 VrInputManager* input_target = nullptr; | 316 VrInputManager* input_target = nullptr; |
332 | 317 |
333 for (std::size_t i = 0; i < scene_->GetUiElements().size(); ++i) { | 318 for (std::size_t i = 0; i < scene_->GetUiElements().size(); ++i) { |
334 const ContentRectangle* plane = scene_->GetUiElements()[i].get(); | 319 const ContentRectangle* plane = scene_->GetUiElements()[i].get(); |
335 if (!plane->visible || !plane->hit_testable) { | 320 if (!plane->visible || !plane->hit_testable) { |
336 continue; | 321 continue; |
337 } | 322 } |
338 float distance_to_plane = plane->GetRayDistance(kOrigin, eye_to_target); | 323 float distance_to_plane = plane->GetRayDistance(kOrigin, eye_to_target); |
339 gvr::Vec3f plane_intersection_point = | 324 gvr::Vec3f plane_intersection_point = |
340 GetRayPoint(kOrigin, eye_to_target, distance_to_plane); | 325 GetRayPoint(kOrigin, eye_to_target, distance_to_plane); |
341 | 326 |
342 gvr::Vec3f rect_2d_point = | 327 gvr::Vec3f rect_2d_point = |
343 MatrixVectorMul(plane->transform.from_world, plane_intersection_point); | 328 MatrixVectorMul(plane->transform.from_world, plane_intersection_point); |
344 if (distance_to_plane > 0 && distance_to_plane < closest_element_distance) { | 329 if (distance_to_plane > 0 && distance_to_plane < closest_element_distance) { |
345 float x = rect_2d_point.x + 0.5f; | 330 float x = rect_2d_point.x + 0.5f; |
346 float y = 0.5f - rect_2d_point.y; | 331 float y = 0.5f - rect_2d_point.y; |
347 bool is_inside = x >= 0.0f && x < 1.0f && y >= 0.0f && y < 1.0f; | 332 bool is_inside = x >= 0.0f && x < 1.0f && y >= 0.0f && y < 1.0f; |
348 if (is_inside) { | 333 if (is_inside) { |
349 closest_element_distance = distance_to_plane; | 334 closest_element_distance = distance_to_plane; |
350 pixel_x = | 335 pixel_x = |
351 static_cast<int>(plane->copy_rect.width * x + plane->copy_rect.x); | 336 static_cast<int>(plane->copy_rect.width * x + plane->copy_rect.x); |
352 pixel_y = | 337 pixel_y = |
353 static_cast<int>(plane->copy_rect.height * y + plane->copy_rect.y); | 338 static_cast<int>(plane->copy_rect.height * y + plane->copy_rect.y); |
354 | 339 |
355 target_point_ = plane_intersection_point; | 340 target_point_ = plane_intersection_point; |
356 target_element_ = plane; | 341 target_element_ = plane; |
357 input_target = (plane->id == kBrowserUiElementId) | 342 input_target = plane->content_quad ? content_input_manager_.get() : |
358 ? content_input_manager_.get() : ui_input_manager_.get(); | 343 ui_input_manager_.get(); |
359 } | 344 } |
360 } | 345 } |
361 } | 346 } |
362 bool new_target = input_target != current_input_target_; | 347 bool new_target = input_target != current_input_target_; |
363 if (new_target && current_input_target_ != nullptr) { | 348 if (new_target && current_input_target_ != nullptr) { |
364 // Send a move event indicating that the pointer moved off of an element. | 349 // Send a move event indicating that the pointer moved off of an element. |
365 gesture->type = WebInputEvent::MouseLeave; | 350 gesture->type = WebInputEvent::MouseLeave; |
366 gesture->details.move.delta.x = 0; | 351 gesture->details.move.delta.x = 0; |
367 gesture->details.move.delta.y = 0; | 352 gesture->details.move.delta.y = 0; |
368 current_input_target_->ProcessUpdatedGesture(*gesture.get()); | 353 current_input_target_->ProcessUpdatedGesture(*gesture.get()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // it. For now, removing it seems working fine. | 408 // it. For now, removing it seems working fine. |
424 gvr_api_->ApplyNeckModel(head_pose, 1.0f); | 409 gvr_api_->ApplyNeckModel(head_pose, 1.0f); |
425 } | 410 } |
426 | 411 |
427 // Bind the primary framebuffer. | 412 // Bind the primary framebuffer. |
428 frame.BindBuffer(kFramePrimaryBuffer); | 413 frame.BindBuffer(kFramePrimaryBuffer); |
429 | 414 |
430 HandleQueuedTasks(); | 415 HandleQueuedTasks(); |
431 | 416 |
432 // Update the render position of all UI elements (including desktop). | 417 // Update the render position of all UI elements (including desktop). |
433 float screen_tilt = desktop_screen_tilt_ * M_PI / 180.0f; | 418 const float screen_tilt = kDesktopScreenTiltDefault * M_PI / 180.0f; |
434 scene_->UpdateTransforms(screen_tilt, UiScene::TimeInMicroseconds()); | 419 scene_->UpdateTransforms(screen_tilt, UiScene::TimeInMicroseconds()); |
435 | 420 |
436 UpdateController(GetForwardVector(head_pose)); | 421 UpdateController(GetForwardVector(head_pose)); |
437 | 422 |
438 if (webvr_mode_) { | 423 if (webvr_mode_) { |
439 DrawWebVr(); | 424 DrawWebVr(); |
440 | 425 |
441 // When using async reprojection, we need to know which pose was used in | 426 // When using async reprojection, we need to know which pose was used in |
442 // the WebVR app for drawing this frame. Due to unknown amounts of | 427 // the WebVR app for drawing this frame. Due to unknown amounts of |
443 // buffering in the compositor and SurfaceTexture, we read the pose number | 428 // buffering in the compositor and SurfaceTexture, we read the pose number |
(...skipping 14 matching lines...) Expand all Loading... |
458 } | 443 } |
459 | 444 |
460 void VrShell::DrawVrShell(const gvr::Mat4f& head_pose, | 445 void VrShell::DrawVrShell(const gvr::Mat4f& head_pose, |
461 gvr::Frame &frame) { | 446 gvr::Frame &frame) { |
462 std::vector<const ContentRectangle*> head_locked_elements; | 447 std::vector<const ContentRectangle*> head_locked_elements; |
463 std::vector<const ContentRectangle*> world_elements; | 448 std::vector<const ContentRectangle*> world_elements; |
464 for (const auto& rect : scene_->GetUiElements()) { | 449 for (const auto& rect : scene_->GetUiElements()) { |
465 if (!rect->visible) { | 450 if (!rect->visible) { |
466 continue; | 451 continue; |
467 } | 452 } |
468 if (webvr_mode_ && rect->id == kBrowserUiElementId) { | |
469 continue; | |
470 } | |
471 if (rect->lock_to_fov) { | 453 if (rect->lock_to_fov) { |
472 head_locked_elements.push_back(rect.get()); | 454 head_locked_elements.push_back(rect.get()); |
473 } else { | 455 } else { |
474 world_elements.push_back(rect.get()); | 456 world_elements.push_back(rect.get()); |
475 } | 457 } |
476 } | 458 } |
477 | 459 |
478 if (!webvr_mode_) { | 460 if (!webvr_mode_) { |
479 glEnable(GL_CULL_FACE); | 461 glEnable(GL_CULL_FACE); |
480 glEnable(GL_DEPTH_TEST); | 462 glEnable(GL_DEPTH_TEST); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 518 } |
537 } | 519 } |
538 } | 520 } |
539 | 521 |
540 void VrShell::DrawElements( | 522 void VrShell::DrawElements( |
541 const gvr::Mat4f& render_matrix, | 523 const gvr::Mat4f& render_matrix, |
542 const std::vector<const ContentRectangle*>& elements) { | 524 const std::vector<const ContentRectangle*>& elements) { |
543 for (const auto& rect : elements) { | 525 for (const auto& rect : elements) { |
544 Rectf copy_rect; | 526 Rectf copy_rect; |
545 jint texture_handle; | 527 jint texture_handle; |
546 if (rect->id == kBrowserUiElementId) { | 528 if (rect->content_quad) { |
547 copy_rect = {0, 0, 1, 1}; | 529 copy_rect = {0, 0, 1, 1}; |
548 texture_handle = content_texture_id_; | 530 texture_handle = content_texture_id_; |
549 } else { | 531 } else { |
550 copy_rect.x = static_cast<float>(rect->copy_rect.x) / ui_tex_width_; | 532 copy_rect.x = static_cast<float>(rect->copy_rect.x) / ui_tex_width_; |
551 copy_rect.y = static_cast<float>(rect->copy_rect.y) / ui_tex_height_; | 533 copy_rect.y = static_cast<float>(rect->copy_rect.y) / ui_tex_height_; |
552 copy_rect.width = static_cast<float>(rect->copy_rect.width) / | 534 copy_rect.width = static_cast<float>(rect->copy_rect.width) / |
553 ui_tex_width_; | 535 ui_tex_width_; |
554 copy_rect.height = static_cast<float>(rect->copy_rect.height) / | 536 copy_rect.height = static_cast<float>(rect->copy_rect.height) / |
555 ui_tex_height_; | 537 ui_tex_height_; |
556 texture_handle = ui_texture_id_; | 538 texture_handle = ui_texture_id_; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 gvr::GvrApi* VrShell::gvr_api() { | 704 gvr::GvrApi* VrShell::gvr_api() { |
723 return gvr_api_.get(); | 705 return gvr_api_.get(); |
724 } | 706 } |
725 | 707 |
726 void VrShell::ContentSurfaceChanged(JNIEnv* env, | 708 void VrShell::ContentSurfaceChanged(JNIEnv* env, |
727 const JavaParamRef<jobject>& object, | 709 const JavaParamRef<jobject>& object, |
728 jint width, | 710 jint width, |
729 jint height, | 711 jint height, |
730 const JavaParamRef<jobject>& surface) { | 712 const JavaParamRef<jobject>& surface) { |
731 content_compositor_->SurfaceChanged((int)width, (int)height, surface); | 713 content_compositor_->SurfaceChanged((int)width, (int)height, surface); |
732 content::ScreenInfo result; | |
733 main_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost()-> | |
734 GetScreenInfo(&result); | |
735 float dpr = result.device_scale_factor; | |
736 scene_->GetUiElementById(kBrowserUiElementId)->copy_rect = | |
737 { 0, 0, width / dpr, height / dpr }; | |
738 } | 714 } |
739 | 715 |
740 void VrShell::UiSurfaceChanged(JNIEnv* env, | 716 void VrShell::UiSurfaceChanged(JNIEnv* env, |
741 const JavaParamRef<jobject>& object, | 717 const JavaParamRef<jobject>& object, |
742 jint width, | 718 jint width, |
743 jint height, | 719 jint height, |
744 const JavaParamRef<jobject>& surface) { | 720 const JavaParamRef<jobject>& surface) { |
745 ui_compositor_->SurfaceChanged((int)width, (int)height, surface); | 721 ui_compositor_->SurfaceChanged((int)width, (int)height, surface); |
746 content::ScreenInfo result; | 722 content::ScreenInfo result; |
747 ui_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost()->GetScreenInfo( | 723 ui_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost()->GetScreenInfo( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 const JavaParamRef<jobject>& ui_web_contents, | 789 const JavaParamRef<jobject>& ui_web_contents, |
814 jlong ui_window_android) { | 790 jlong ui_window_android) { |
815 return reinterpret_cast<intptr_t>(new VrShell( | 791 return reinterpret_cast<intptr_t>(new VrShell( |
816 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 792 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
817 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 793 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
818 content::WebContents::FromJavaWebContents(ui_web_contents), | 794 content::WebContents::FromJavaWebContents(ui_web_contents), |
819 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); | 795 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); |
820 } | 796 } |
821 | 797 |
822 } // namespace vr_shell | 798 } // namespace vr_shell |
OLD | NEW |