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

Side by Side Diff: chrome/browser/android/vr_shell/ui_elements/screen_dimmer.cc

Issue 2906423002: [vr] Migrate from vr::Colorf to SkColor (Closed)
Patch Set: Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h" 5 #include "chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h"
6 6
7 #include "chrome/browser/android/vr_shell/vr_shell_renderer.h" 7 #include "chrome/browser/android/vr_shell/vr_shell_renderer.h"
8 #include "device/vr/vr_math.h" 8 #include "device/vr/vr_math.h"
9 #include "third_party/skia/include/core/SkColor.h"
9 10
10 namespace vr_shell { 11 namespace vr_shell {
11 12
12 ScreenDimmer::ScreenDimmer() 13 namespace {
13 : inner_color_({0.05f, 0.05f, 0.05f, 0.8f}), 14 static const SkColor kDimmerInnerColor = 0xCC0D0D0D;
14 outer_color_({0, 0, 0, 0.9f}), 15 static const SkColor kDimmerOuterColor = 0xE6000000;
15 opacity_(0.9f) {} 16 static const float kDimmerOpacity = 0.9f;
17 } // namespace
18
19 ScreenDimmer::ScreenDimmer() {}
16 20
17 ScreenDimmer::~ScreenDimmer() = default; 21 ScreenDimmer::~ScreenDimmer() = default;
18 22
19 void ScreenDimmer::Initialize() { 23 void ScreenDimmer::Initialize() {
20 set_fill(Fill::SELF); 24 set_fill(Fill::SELF);
21 } 25 }
22 26
23 void ScreenDimmer::Render(VrShellRenderer* renderer, 27 void ScreenDimmer::Render(VrShellRenderer* renderer,
24 vr::Mat4f view_proj_matrix) const { 28 vr::Mat4f view_proj_matrix) const {
25 vr::Mat4f m; 29 vr::Mat4f m;
26 vr::SetIdentityM(&m); 30 vr::SetIdentityM(&m);
27 vr::ScaleM(m, {2.0f, 2.0f, 1.0f}, &m); 31 vr::ScaleM(m, {2.0f, 2.0f, 1.0f}, &m);
28 renderer->GetGradientQuadRenderer()->Draw(m, outer_color_, inner_color_, 32 renderer->GetGradientQuadRenderer()->Draw(m, kDimmerOuterColor,
29 opacity_); 33 kDimmerInnerColor, kDimmerOpacity);
30 } 34 }
31 35
32 } // namespace vr_shell 36 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_elements/screen_dimmer.h ('k') | chrome/browser/android/vr_shell/ui_elements/ui_element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698