Commit 118f0d2f authored by Aldo Culquicondor's avatar Aldo Culquicondor Committed by Commit Bot

VR: keep track of dialog buffer size

When entering presentation mode from 2D browsing, the content's buffer
size is not set, and thus VrShellGl uses the wrong buffer size for the
dialogs.

Bug: 856727
Change-Id: Idf740285739e026a818b44c85fd05b34edfbd17f
Reviewed-on: https://chromium-review.googlesource.com/1124864Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Aldo Culquicondor <acondor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572271}
parent 130d03a8
......@@ -662,6 +662,10 @@ void VrShell::SetDialogBufferSize(
float height) {
if (ui_surface_texture_)
ui_surface_texture_->SetDefaultBufferSize(width, height);
PostToGlThread(
FROM_HERE,
base::BindOnce(&VrShellGl::DialogBufferBoundsChanged,
gl_thread_->GetVrShellGl(), gfx::Size(width, height)));
}
void VrShell::SetAlertDialogSize(
......
......@@ -441,8 +441,8 @@ void VrShellGl::InitializeGl(gfx::AcceleratedWidget window) {
content_tex_buffer_size_.width(), content_tex_buffer_size_.height());
content_overlay_surface_texture_->SetDefaultBufferSize(
content_tex_buffer_size_.width(), content_tex_buffer_size_.height());
ui_surface_texture_->SetDefaultBufferSize(content_tex_buffer_size_.width(),
content_tex_buffer_size_.height());
ui_surface_texture_->SetDefaultBufferSize(dialog_tex_buffer_size_.width(),
dialog_tex_buffer_size_.height());
webvr_vsync_align_ = base::FeatureList::IsEnabled(features::kWebVrVsyncAlign);
......@@ -887,8 +887,8 @@ void VrShellGl::EnableAlertDialog(PlatformInputHandler* input_handler,
vr_dialog_input_delegate_.reset(new PlatformUiInputDelegate(input_handler));
vr_dialog_input_delegate_->SetSize(width, height);
ui_->SetAlertDialogEnabled(true, vr_dialog_input_delegate_.get(),
width / content_tex_buffer_size_.width(),
height / content_tex_buffer_size_.width());
width / dialog_tex_buffer_size_.width(),
height / dialog_tex_buffer_size_.width());
ScheduleOrCancelWebVrFrameTimeout();
}
......@@ -902,8 +902,8 @@ void VrShellGl::DisableAlertDialog() {
void VrShellGl::SetAlertDialogSize(float width, float height) {
if (vr_dialog_input_delegate_)
vr_dialog_input_delegate_->SetSize(width, height);
ui_->SetAlertDialogSize(width / content_tex_buffer_size_.width(),
height / content_tex_buffer_size_.width());
ui_->SetAlertDialogSize(width / dialog_tex_buffer_size_.width(),
height / dialog_tex_buffer_size_.width());
}
void VrShellGl::SetDialogLocation(float x, float y) {
......@@ -2151,6 +2151,10 @@ void VrShellGl::BufferBoundsChanged(const gfx::Size& content_buffer_size,
content_tex_buffer_size_ = content_buffer_size;
}
void VrShellGl::DialogBufferBoundsChanged(const gfx::Size& size) {
dialog_tex_buffer_size_ = size;
}
base::WeakPtr<VrShellGl> VrShellGl::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
......
......@@ -300,6 +300,7 @@ class VrShellGl : public device::mojom::VRPresentationProvider {
void ContentBoundsChanged(int width, int height);
void BufferBoundsChanged(const gfx::Size& content_buffer_size,
const gfx::Size& overlay_buffer_size);
void DialogBufferBoundsChanged(const gfx::Size& size);
void UIBoundsChanged(int width, int height);
void ResumeContentRendering();
......@@ -519,8 +520,9 @@ class VrShellGl : public device::mojom::VRPresentationProvider {
bool cardboard_ = false;
gfx::Quaternion controller_quat_;
gfx::Size content_tex_buffer_size_ = {0, 0};
gfx::Size webvr_surface_size_ = {0, 0};
gfx::Size content_tex_buffer_size_;
gfx::Size webvr_surface_size_;
gfx::Size dialog_tex_buffer_size_;
std::unique_ptr<WebXrPresentationState> webxr_ = nullptr;
......
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