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

Side by Side Diff: content/browser/vr/test/fake_vr_device.cc

Issue 829803003: Adding Chrome-side WebVR interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback from mdempsky Created 5 years, 7 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/vr/test/fake_vr_device.h"
6
7 namespace content {
8
9 FakeVRDevice::FakeVRDevice(VRDeviceProvider* provider)
10 : VRDevice(provider), device_(), state_() width_(0), height_(0) {
11 }
12
13 FakeVRDevice::~FakeVRDevice() {
14 }
15
16 void FakeVRDevice::SetVRDevice(const blink::WebVRDevice& device) {
17 device_ = device;
18 }
19
20 void FakeVRDevice::SetSensorState(const blink::WebHMDSensorState& state) {
21 state_ = state;
22 }
23
24 void FakeVRDevice::SetRenderTargetSize(unsigned int width,
25 unsigned int height) {
26 width_ = width;
27 height_ = height;
28 }
29
30 void FakeVRDevice::GetVRDevice(blink::WebVRDevice* device) {
31 *device = device_;
32 }
33
34 void FakeVRDevice::GetSensorState(blink::WebHMDSensorState* state) {
35 *state = state_;
36 }
37
38 void FakeVRDevice::GetRenderTargetRects(blink::WebVRFieldOfView leftFov,
39 blink::WebVRFieldOfView rightFov,
40 blink::WebVRVector4* leftRect,
41 blink::WebVRVector4* rightRect) {
42 leftRect->x = 0;
43 leftRect->y = 0;
44 leftRect->z = width_ / 2.0;
45 leftRect->w = height_;
46
47 rightRect->x = width_ / 2.0;
48 rightRect->y = 0;
49 rightRect->z = width_ / 2.0;
50 rightRect->w = height_;
51 }
52
53 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698