Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_shell_gl.cc |
| diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc |
| index 78bc7f8c5007445c4131c3434717d8352f63fb0c..f234217ca5100ba764a7059f1dfd5e9a1c9c7fb0 100644 |
| --- a/chrome/browser/android/vr_shell/vr_shell_gl.cc |
| +++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc |
| @@ -720,9 +720,7 @@ void VrShellGl::DrawVrShell(const gvr::Mat4f& head_pose, |
| glEnable(GL_DEPTH_TEST); |
| glDepthMask(GL_TRUE); |
| - glClearColor(BackgroundRenderer::kFogBrightness, |
| - BackgroundRenderer::kFogBrightness, |
| - BackgroundRenderer::kFogBrightness, 1.0f); |
| + glClearColor(kFogBrightness, kFogBrightness, kFogBrightness, 1.0f); |
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| } |
| if (!world_elements.empty()) { |
| @@ -783,10 +781,6 @@ void VrShellGl::DrawUiView(const gvr::Mat4f* head_pose, |
| buffer_viewport_->GetSourceFov(), kZNear, kZFar), |
| view_matrix); |
| - if (!web_vr_mode_) { |
| - // TODO(tiborg): Enable through the UI API. |
| - // DrawBackground(render_matrix); |
| - } |
| DrawElements(render_matrix, elements); |
| if (head_pose != nullptr && !web_vr_mode_) { |
| DrawCursor(render_matrix); |
| @@ -798,23 +792,44 @@ void VrShellGl::DrawElements( |
| const gvr::Mat4f& render_matrix, |
| const std::vector<const ContentRectangle*>& elements) { |
| for (const auto& rect : elements) { |
| - Rectf copy_rect; |
| - jint texture_handle; |
| - if (rect->content_quad) { |
| - copy_rect = {0, 0, 1, 1}; |
| - texture_handle = content_texture_id_; |
| - } else { |
| - copy_rect.x = static_cast<float>(rect->copy_rect.x) / ui_tex_css_width_; |
| - copy_rect.y = static_cast<float>(rect->copy_rect.y) / ui_tex_css_height_; |
| - copy_rect.width = static_cast<float>(rect->copy_rect.width) / |
| - ui_tex_css_width_; |
| - copy_rect.height = static_cast<float>(rect->copy_rect.height) / |
| - ui_tex_css_height_; |
| - texture_handle = ui_texture_id_; |
| + switch (rect->fill) { |
| + case Fill::SPRITE: { |
| + Rectf copy_rect; |
| + jint texture_handle; |
| + if (rect->content_quad) { |
| + copy_rect = {0, 0, 1, 1}; |
| + texture_handle = content_texture_id_; |
| + } else { |
| + copy_rect.x = |
| + static_cast<float>(rect->copy_rect.x) / ui_tex_css_width_; |
| + copy_rect.y = |
| + static_cast<float>(rect->copy_rect.y) / ui_tex_css_height_; |
| + copy_rect.width = |
| + static_cast<float>(rect->copy_rect.width) / ui_tex_css_width_; |
| + copy_rect.height = |
| + static_cast<float>(rect->copy_rect.height) / ui_tex_css_height_; |
| + texture_handle = ui_texture_id_; |
| + } |
| + gvr::Mat4f transform = |
| + MatrixMul(render_matrix, rect->transform.to_world); |
| + vr_shell_renderer_->GetTexturedQuadRenderer()->Draw( |
| + texture_handle, transform, copy_rect, rect->computed_opacity); |
| + } break; |
|
mthiesse
2017/01/31 20:54:54
nit: break; should go inside braces.
tiborg1
2017/02/01 00:22:18
Done.
|
| + case Fill::OPAQUE_GRADIENT: { |
| + gvr::Mat4f transform = |
| + MatrixMul(render_matrix, rect->transform.to_world); |
| + vr_shell_renderer_->GetGradientQuadRenderer()->Draw( |
| + transform, rect->center_color, rect->edge_color); |
|
mthiesse
2017/01/31 20:54:54
Should this not respect opacity?
tiborg1
2017/02/01 00:22:18
Good point! It's fixed.
|
| + } break; |
| + case Fill::GRID_GRADIENT: { |
| + gvr::Mat4f transform = |
| + MatrixMul(render_matrix, rect->transform.to_world); |
| + vr_shell_renderer_->GetGradientGridRenderer()->Draw( |
| + transform, rect->center_color, rect->edge_color, rect->tile_number); |
| + } break; |
| + default: |
| + break; |
| } |
| - gvr::Mat4f transform = MatrixMul(render_matrix, rect->transform.to_world); |
| - vr_shell_renderer_->GetTexturedQuadRenderer()->Draw( |
| - texture_handle, transform, copy_rect, rect->computed_opacity); |
| } |
| } |
| @@ -905,10 +920,6 @@ void VrShellGl::DrawWebVr() { |
| vr_shell_renderer_->GetWebVrRenderer()->Draw(webvr_texture_id_); |
| } |
| -void VrShellGl::DrawBackground(const gvr::Mat4f& render_matrix) { |
| - vr_shell_renderer_->GetBackgroundRenderer()->Draw(render_matrix); |
| -} |
| - |
| void VrShellGl::OnTriggerEvent() { |
| // Set a flag to handle this on the render thread at the next frame. |
| touch_pending_ = true; |