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

Side by Side Diff: chrome/browser/android/vr_shell/textures/loading_indicator_texture.cc

Issue 2926643003: [VrShell] Centralize color handling and enable close button on fullscreen (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/textures/loading_indicator_texture.h" 5 #include "chrome/browser/android/vr_shell/textures/loading_indicator_texture.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/paint/skia_paint_canvas.h" 8 #include "cc/paint/skia_paint_canvas.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkColor.h"
11 10
12 namespace vr_shell { 11 namespace vr_shell {
13 12
14 namespace { 13 namespace {
15 14
16 static constexpr SkColor kBackground = 0xFF8C8C8C;
17 static constexpr SkColor kForeground = 0xFF333333;
18 static constexpr float kWidth = 0.24; 15 static constexpr float kWidth = 0.24;
19 static constexpr float kHeight = 0.008; 16 static constexpr float kHeight = 0.008;
20 17
21 } // namespace 18 } // namespace
22 19
23 LoadingIndicatorTexture::LoadingIndicatorTexture() = default; 20 LoadingIndicatorTexture::LoadingIndicatorTexture() = default;
24 21
25 LoadingIndicatorTexture::~LoadingIndicatorTexture() = default; 22 LoadingIndicatorTexture::~LoadingIndicatorTexture() = default;
26 23
27 gfx::Size LoadingIndicatorTexture::GetPreferredTextureSize( 24 gfx::Size LoadingIndicatorTexture::GetPreferredTextureSize(
(...skipping 23 matching lines...) Expand all
51 48
52 void LoadingIndicatorTexture::Draw(SkCanvas* canvas, 49 void LoadingIndicatorTexture::Draw(SkCanvas* canvas,
53 const gfx::Size& texture_size) { 50 const gfx::Size& texture_size) {
54 size_.set_height(texture_size.height()); 51 size_.set_height(texture_size.height());
55 size_.set_width(texture_size.width()); 52 size_.set_width(texture_size.width());
56 53
57 canvas->save(); 54 canvas->save();
58 canvas->scale(size_.width() / kWidth, size_.width() / kWidth); 55 canvas->scale(size_.width() / kWidth, size_.width() / kWidth);
59 56
60 SkPaint paint; 57 SkPaint paint;
61 paint.setColor(kBackground); 58 paint.setColor(color_scheme().loading_indicator_background);
62 canvas->drawRoundRect({0, 0, kWidth, kHeight}, kHeight / 2, kHeight / 2, 59 canvas->drawRoundRect({0, 0, kWidth, kHeight}, kHeight / 2, kHeight / 2,
63 paint); 60 paint);
64 61
65 if (loading_) { 62 if (loading_) {
66 paint.setColor(kForeground); 63 paint.setColor(color_scheme().loading_indicator_foreground);
67 float progress_width = kHeight + (kWidth - kHeight) * progress_; 64 float progress_width = kHeight + (kWidth - kHeight) * progress_;
68 canvas->drawRoundRect({0, 0, progress_width, kHeight}, kHeight / 2, 65 canvas->drawRoundRect({0, 0, progress_width, kHeight}, kHeight / 2,
69 kHeight / 2, paint); 66 kHeight / 2, paint);
70 } 67 }
71 68
72 canvas->restore(); 69 canvas->restore();
73 } 70 }
74 71
75 } // namespace vr_shell 72 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698