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

Unified Diff: third_party/WebKit/Source/modules/vr/VRFrameData.cpp

Issue 2494983003: Mojo C++ bindings: switch device/vr mojom target to use STL/WTF types. (Closed)
Patch Set: . 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/test/fake_vr_device.cc ('k') | third_party/WebKit/Source/modules/vr/VRPose.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/vr/VRFrameData.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRFrameData.cpp b/third_party/WebKit/Source/modules/vr/VRFrameData.cpp
index f2c447be5416b5f055a5f5721d19b1a623969b07..6395e5d6c9ccc50678d2d7ef754785abc9ff7b98 100644
--- a/third_party/WebKit/Source/modules/vr/VRFrameData.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRFrameData.cpp
@@ -47,14 +47,15 @@ void projectionFromFieldOfView(DOMFloat32Array* outArray,
}
// Create a matrix from a rotation and translation.
-void matrixfromRotationTranslation(DOMFloat32Array* outArray,
- const mojo::WTFArray<float>& rotation,
- const mojo::WTFArray<float>& translation) {
+void matrixfromRotationTranslation(
+ DOMFloat32Array* outArray,
+ const WTF::Optional<WTF::Vector<float>>& rotation,
+ const WTF::Optional<WTF::Vector<float>>& translation) {
// Quaternion math
- float x = rotation.is_null() ? 0.0f : rotation[0];
- float y = rotation.is_null() ? 0.0f : rotation[1];
- float z = rotation.is_null() ? 0.0f : rotation[2];
- float w = rotation.is_null() ? 1.0f : rotation[3];
+ float x = !rotation ? 0.0f : rotation.value()[0];
+ float y = !rotation ? 0.0f : rotation.value()[1];
+ float z = !rotation ? 0.0f : rotation.value()[2];
+ float w = !rotation ? 1.0f : rotation.value()[3];
float x2 = x + x;
float y2 = y + y;
float z2 = z + z;
@@ -82,9 +83,9 @@ void matrixfromRotationTranslation(DOMFloat32Array* outArray,
out[9] = yz - wx;
out[10] = 1 - (xx + yy);
out[11] = 0;
- out[12] = translation.is_null() ? 0.0f : translation[0];
- out[13] = translation.is_null() ? 0.0f : translation[1];
- out[14] = translation.is_null() ? 0.0f : translation[2];
+ out[12] = !translation ? 0.0f : translation.value()[0];
+ out[13] = !translation ? 0.0f : translation.value()[1];
+ out[14] = !translation ? 0.0f : translation.value()[2];
out[15] = 1;
}
« no previous file with comments | « device/vr/test/fake_vr_device.cc ('k') | third_party/WebKit/Source/modules/vr/VRPose.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698