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

Side by Side Diff: device/vr/android/gvr/gvr_device.cc

Issue 2612333002: Allow VRDisplay to specify which frame the layer bounds should be updated at. (Closed)
Patch Set: Created 3 years, 11 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 "device/vr/android/gvr/gvr_device.h" 5 #include "device/vr/android/gvr/gvr_device.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 void GvrDevice::ExitPresent() { 234 void GvrDevice::ExitPresent() {
235 gvr_provider_->ExitPresent(); 235 gvr_provider_->ExitPresent();
236 OnExitPresent(); 236 OnExitPresent();
237 } 237 }
238 238
239 void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) { 239 void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) {
240 if (delegate_) 240 if (delegate_)
241 delegate_->SubmitWebVRFrame(); 241 delegate_->SubmitWebVRFrame();
242 } 242 }
243 243
244 void GvrDevice::UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds, 244 void GvrDevice::UpdateLayerBounds(uint32_t frame_index,
245 mojom::VRLayerBoundsPtr left_bounds,
245 mojom::VRLayerBoundsPtr right_bounds) { 246 mojom::VRLayerBoundsPtr right_bounds) {
246 if (!delegate_) 247 if (!delegate_)
247 return; 248 return;
248 249
249 gvr::Rectf left_gvr_bounds; 250 gvr::Rectf left_gvr_bounds;
250 left_gvr_bounds.left = left_bounds->left; 251 left_gvr_bounds.left = left_bounds->left;
251 left_gvr_bounds.top = 1.0f - left_bounds->top; 252 left_gvr_bounds.top = 1.0f - left_bounds->top;
252 left_gvr_bounds.right = left_bounds->left + left_bounds->width; 253 left_gvr_bounds.right = left_bounds->left + left_bounds->width;
253 left_gvr_bounds.bottom = 1.0f - (left_bounds->top + left_bounds->height); 254 left_gvr_bounds.bottom = 1.0f - (left_bounds->top + left_bounds->height);
254 255
255 gvr::Rectf right_gvr_bounds; 256 gvr::Rectf right_gvr_bounds;
256 right_gvr_bounds.left = right_bounds->left; 257 right_gvr_bounds.left = right_bounds->left;
257 right_gvr_bounds.top = 1.0f - right_bounds->top; 258 right_gvr_bounds.top = 1.0f - right_bounds->top;
258 right_gvr_bounds.right = right_bounds->left + right_bounds->width; 259 right_gvr_bounds.right = right_bounds->left + right_bounds->width;
259 right_gvr_bounds.bottom = 1.0f - (right_bounds->top + right_bounds->height); 260 right_gvr_bounds.bottom = 1.0f - (right_bounds->top + right_bounds->height);
260 261
261 delegate_->UpdateWebVRTextureBounds(left_gvr_bounds, right_gvr_bounds); 262 delegate_->UpdateWebVRTextureBounds(frame_index, left_gvr_bounds,
263 right_gvr_bounds);
262 } 264 }
263 265
264 void GvrDevice::SetDelegate(GvrDelegate* delegate) { 266 void GvrDevice::SetDelegate(GvrDelegate* delegate) {
265 delegate_ = delegate; 267 delegate_ = delegate;
266 268
267 // Notify the clients that this device has changed 269 // Notify the clients that this device has changed
268 if (delegate_) { 270 if (delegate_) {
269 delegate_->SetWebVRSecureOrigin(secure_origin_); 271 delegate_->SetWebVRSecureOrigin(secure_origin_);
270 OnChanged(); 272 OnChanged();
271 } 273 }
272 } 274 }
273 275
274 gvr::GvrApi* GvrDevice::GetGvrApi() { 276 gvr::GvrApi* GvrDevice::GetGvrApi() {
275 if (!delegate_) 277 if (!delegate_)
276 return nullptr; 278 return nullptr;
277 279
278 return delegate_->gvr_api(); 280 return delegate_->gvr_api();
279 } 281 }
280 282
281 } // namespace device 283 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698