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

Unified Diff: device/vr/android/gvr/gvr_device.cc

Issue 2499793002: Refactoring how WebVR eye bounds are handled (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/vr/android/gvr/gvr_device.h ('k') | device/vr/vr_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/android/gvr/gvr_device.cc
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc
index d369134ce13cc602db8e370787c38a792a0a4e3a..6a442569166233bdbd01a36528b954312158b49c 100644
--- a/device/vr/android/gvr/gvr_device.cc
+++ b/device/vr/android/gvr/gvr_device.cc
@@ -218,17 +218,24 @@ void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) {
delegate_->SubmitWebVRFrame();
}
-void GvrDevice::UpdateLayerBounds(mojom::VRLayerBoundsPtr leftBounds,
- mojom::VRLayerBoundsPtr rightBounds) {
+void GvrDevice::UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds,
+ mojom::VRLayerBoundsPtr right_bounds) {
if (!delegate_)
return;
- delegate_->UpdateWebVRTextureBounds(0, // Left eye
- leftBounds->left, leftBounds->top,
- leftBounds->width, leftBounds->height);
- delegate_->UpdateWebVRTextureBounds(1, // Right eye
- rightBounds->left, rightBounds->top,
- rightBounds->width, rightBounds->height);
+ gvr::Rectf left_gvr_bounds;
+ left_gvr_bounds.left = left_bounds->left;
+ left_gvr_bounds.top = 1.0f - left_bounds->top;
+ left_gvr_bounds.right = left_bounds->left + left_bounds->width;
+ left_gvr_bounds.bottom = 1.0f - (left_bounds->top + left_bounds->height);
+
+ gvr::Rectf right_gvr_bounds;
+ right_gvr_bounds.left = right_bounds->left;
+ right_gvr_bounds.top = 1.0f - right_bounds->top;
+ right_gvr_bounds.right = right_bounds->left + right_bounds->width;
+ right_gvr_bounds.bottom = 1.0f - (right_bounds->top + right_bounds->height);
+
+ delegate_->UpdateWebVRTextureBounds(left_gvr_bounds, right_gvr_bounds);
}
void GvrDevice::SetDelegate(const base::WeakPtr<GvrDelegate>& delegate) {
« no previous file with comments | « device/vr/android/gvr/gvr_device.h ('k') | device/vr/vr_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698