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

Side by Side Diff: chrome/browser/android/vr_shell/textures/ui_texture.h

Issue 2902043005: [vr] Add incognito coloring (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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_UI_TEXTURE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_UI_TEXTURE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_UI_TEXTURE_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_UI_TEXTURE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "chrome/browser/android/vr_shell/color_scheme.h"
13 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
14 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
16 #include "ui/gfx/geometry/size_f.h" 17 #include "ui/gfx/geometry/size_f.h"
17 18
18 class SkCanvas; 19 class SkCanvas;
19 20
20 namespace gfx { 21 namespace gfx {
21 22
22 class FontList; 23 class FontList;
23 class PointF; 24 class PointF;
24 class RenderText; 25 class RenderText;
25 26
26 } // namespace gfx 27 } // namespace gfx
27 28
28 namespace vr_shell { 29 namespace vr_shell {
29 30
30 class UiTexture { 31 class UiTexture {
31 public: 32 public:
32 UiTexture(); 33 UiTexture();
33 virtual ~UiTexture(); 34 virtual ~UiTexture();
34 35
35 void DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size); 36 void DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size);
36 virtual gfx::Size GetPreferredTextureSize(int maximum_width) const = 0; 37 virtual gfx::Size GetPreferredTextureSize(int maximum_width) const = 0;
37 virtual gfx::SizeF GetDrawnSize() const = 0; 38 virtual gfx::SizeF GetDrawnSize() const = 0;
38 virtual bool HitTest(const gfx::PointF& point) const; 39 virtual bool HitTest(const gfx::PointF& point) const;
39 40
40 bool dirty() const { return dirty_; } 41 bool dirty() const { return dirty_; }
41 42
43 void SetMode(ColorScheme::Mode mode);
44
42 protected: 45 protected:
43 enum TextAlignment { 46 enum TextAlignment {
44 kTextAlignmentNone, 47 kTextAlignmentNone,
45 kTextAlignmentLeft, 48 kTextAlignmentLeft,
46 kTextAlignmentCenter, 49 kTextAlignmentCenter,
47 kTextAlignmentRight, 50 kTextAlignmentRight,
48 }; 51 };
49 52
50 enum WrappingBehavior { 53 enum WrappingBehavior {
51 kWrappingBehaviorWrap, 54 kWrappingBehaviorWrap,
52 kWrappingBehaviorNoWrap, 55 kWrappingBehaviorNoWrap,
53 }; 56 };
54 57
55 virtual void Draw(SkCanvas* canvas, const gfx::Size& texture_size) = 0; 58 virtual void Draw(SkCanvas* canvas, const gfx::Size& texture_size) = 0;
56 59
60 virtual void OnSetMode();
61 ColorScheme::Mode mode() const { return mode_; }
62
57 // Prepares a set of RenderText objects with the given color and fonts. 63 // Prepares a set of RenderText objects with the given color and fonts.
58 // Attempts to fit the text within the provided size. |flags| specifies how 64 // Attempts to fit the text within the provided size. |flags| specifies how
59 // the text should be rendered. If multiline is requested and provided height 65 // the text should be rendered. If multiline is requested and provided height
60 // is 0, it will be set to the minimum needed to fit the whole text. If 66 // is 0, it will be set to the minimum needed to fit the whole text. If
61 // multiline is not requested and provided width is 0, it will be set to the 67 // multiline is not requested and provided width is 0, it will be set to the
62 // minimum needed to fit the whole text. 68 // minimum needed to fit the whole text.
63 static std::vector<std::unique_ptr<gfx::RenderText>> PrepareDrawStringRect( 69 static std::vector<std::unique_ptr<gfx::RenderText>> PrepareDrawStringRect(
64 const base::string16& text, 70 const base::string16& text,
65 const gfx::FontList& font_list, 71 const gfx::FontList& font_list,
66 SkColor color, 72 SkColor color,
(...skipping 11 matching lines...) Expand all
78 84
79 static bool IsRTL(); 85 static bool IsRTL();
80 static gfx::FontList GetDefaultFontList(int size); 86 static gfx::FontList GetDefaultFontList(int size);
81 static bool GetFontList(int size, 87 static bool GetFontList(int size,
82 base::string16 text, 88 base::string16 text,
83 gfx::FontList* font_list); 89 gfx::FontList* font_list);
84 static void SetForceFontFallbackFailureForTesting(bool force); 90 static void SetForceFontFallbackFailureForTesting(bool force);
85 91
86 private: 92 private:
87 bool dirty_ = true; 93 bool dirty_ = true;
94 ColorScheme::Mode mode_ = ColorScheme::kModeNormal;
88 95
89 DISALLOW_COPY_AND_ASSIGN(UiTexture); 96 DISALLOW_COPY_AND_ASSIGN(UiTexture);
90 }; 97 };
91 98
92 } // namespace vr_shell 99 } // namespace vr_shell
93 100
94 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_UI_TEXTURE_H_ 101 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_TEXTURES_UI_TEXTURE_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/color_scheme.cc ('k') | chrome/browser/android/vr_shell/textures/ui_texture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698