Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2721553004: Remove auto raw pointer deduction from non-linux specific code. (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 if (head_pose != nullptr && !web_vr_mode_) { 826 if (head_pose != nullptr && !web_vr_mode_) {
827 DrawCursor(render_matrix); 827 DrawCursor(render_matrix);
828 } 828 }
829 } 829 }
830 } 830 }
831 831
832 void VrShellGl::DrawElements( 832 void VrShellGl::DrawElements(
833 const gvr::Mat4f& view_proj_matrix, 833 const gvr::Mat4f& view_proj_matrix,
834 const gvr::Mat4f& view_matrix, 834 const gvr::Mat4f& view_matrix,
835 const std::vector<const ContentRectangle*>& elements) { 835 const std::vector<const ContentRectangle*>& elements) {
836 for (auto& rect : elements) { 836 for (const auto* rect : elements) {
837 gvr::Mat4f transform = 837 gvr::Mat4f transform =
838 MatrixMul(view_proj_matrix, rect->transform.to_world); 838 MatrixMul(view_proj_matrix, rect->transform.to_world);
839 839
840 switch (rect->fill) { 840 switch (rect->fill) {
841 case Fill::SPRITE: { 841 case Fill::SPRITE: {
842 Rectf copy_rect; 842 Rectf copy_rect;
843 copy_rect.x = static_cast<float>(rect->copy_rect.x) / ui_tex_css_width_; 843 copy_rect.x = static_cast<float>(rect->copy_rect.x) / ui_tex_css_width_;
844 copy_rect.y = 844 copy_rect.y =
845 static_cast<float>(rect->copy_rect.y) / ui_tex_css_height_; 845 static_cast<float>(rect->copy_rect.y) / ui_tex_css_height_;
846 copy_rect.width = 846 copy_rect.width =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 vr_shell_renderer_->GetTexturedQuadRenderer()->Flush(); 881 vr_shell_renderer_->GetTexturedQuadRenderer()->Flush();
882 } 882 }
883 883
884 std::vector<const ContentRectangle*> VrShellGl::GetElementsInDrawOrder( 884 std::vector<const ContentRectangle*> VrShellGl::GetElementsInDrawOrder(
885 const gvr::Mat4f& view_matrix, 885 const gvr::Mat4f& view_matrix,
886 const std::vector<const ContentRectangle*>& elements) { 886 const std::vector<const ContentRectangle*>& elements) {
887 typedef std::pair<float, const ContentRectangle*> DistanceElementPair; 887 typedef std::pair<float, const ContentRectangle*> DistanceElementPair;
888 std::vector<DistanceElementPair> zOrderedElementPairs; 888 std::vector<DistanceElementPair> zOrderedElementPairs;
889 zOrderedElementPairs.reserve(elements.size()); 889 zOrderedElementPairs.reserve(elements.size());
890 890
891 for (const auto& element : elements) { 891 for (const auto* element : elements) {
892 // Distance is the abs(z) value in view space. 892 // Distance is the abs(z) value in view space.
893 gvr::Vec3f element_position = GetTranslation(element->transform.to_world); 893 gvr::Vec3f element_position = GetTranslation(element->transform.to_world);
894 float distance = 894 float distance =
895 std::fabs(MatrixVectorMul(view_matrix, element_position).z); 895 std::fabs(MatrixVectorMul(view_matrix, element_position).z);
896 zOrderedElementPairs.push_back(std::make_pair(distance, element)); 896 zOrderedElementPairs.push_back(std::make_pair(distance, element));
897 } 897 }
898 898
899 // Sort elements primarily based on their draw phase (lower draw phase first) 899 // Sort elements primarily based on their draw phase (lower draw phase first)
900 // and secondarily based on their distance (larger distance first). 900 // and secondarily based on their distance (larger distance first).
901 std::sort( 901 std::sort(
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 1158 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
1159 uint32_t device_id) { 1159 uint32_t device_id) {
1160 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo( 1160 device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo(
1161 gvr_api_.get(), content_tex_physical_size_, device_id); 1161 gvr_api_.get(), content_tex_physical_size_, device_id);
1162 main_thread_task_runner_->PostTask( 1162 main_thread_task_runner_->PostTask(
1163 FROM_HERE, 1163 FROM_HERE,
1164 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info))); 1164 base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info)));
1165 } 1165 }
1166 1166
1167 } // namespace vr_shell 1167 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698