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

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

Issue 2541023003: WebVR: Add sanity checks for decoded pose index values (Closed)
Patch Set: Add longer wait, 10 frames was not sufficient. Less verbose vlog. Created 4 years 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
Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index c286f069f65efba7d5c194963e6b69a5bd3a168b..3250eb45808d45f826d885811fb4ce388004f173 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -612,8 +612,10 @@ void VRDisplay::submitFrame() {
gl->ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
int idx = m_framePose->poseIndex;
// Careful with the arithmetic here. Float color 1.f is equivalent to int 255.
- gl->ClearColor((idx & 255) / 255.0f, ((idx >> 8) & 255) / 255.0f,
- ((idx >> 16) & 255) / 255.0f, 1.0f);
+ // Use the low byte of the index as the red component, and store an arbitrary
+ // magic number in green/blue. This number must match the reading code in
+ // vr_shell.cc. Avoid all-black/all-white.
+ gl->ClearColor((idx & 255) / 255.0f, 42 / 255.0f, 142 / 255.0f, 1.0f);
mthiesse 2016/12/01 21:53:15 Make constants for the magic numbers, here and in
klausw 2016/12/01 22:36:04 Done.
gl->Clear(GL_COLOR_BUFFER_BIT);
// Set the GL state back to what was set by the WebVR application.
« chrome/browser/android/vr_shell/vr_shell.h ('K') | « device/vr/android/gvr/gvr_device_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698