Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/ui_texture.h" | 5 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/i18n/char_iterator.h" | 11 #include "base/i18n/char_iterator.h" |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "chrome/browser/android/vr_shell/color_scheme.h" | |
|
cjgrant
2017/06/05 17:57:08
This is already in ui_texture.h
amp
2017/06/05 21:40:58
Done.
| |
| 16 #include "chrome/browser/android/vr_shell/font_fallback.h" | 17 #include "chrome/browser/android/vr_shell/font_fallback.h" |
| 17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 18 #include "third_party/icu/source/common/unicode/uscript.h" | 19 #include "third_party/icu/source/common/unicode/uscript.h" |
| 19 #include "third_party/skia/include/core/SkCanvas.h" | 20 #include "third_party/skia/include/core/SkCanvas.h" |
| 20 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 21 #include "ui/gfx/font_list.h" | 22 #include "ui/gfx/font_list.h" |
| 22 #include "ui/gfx/render_text.h" | 23 #include "ui/gfx/render_text.h" |
| 23 #include "ui/gfx/text_elider.h" | 24 #include "ui/gfx/text_elider.h" |
| 24 #include "ui/gl/gl_bindings.h" | 25 #include "ui/gl/gl_bindings.h" |
| 25 | 26 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 | 59 |
| 59 void UiTexture::SetMode(ColorScheme::Mode mode) { | 60 void UiTexture::SetMode(ColorScheme::Mode mode) { |
| 60 if (mode_ == mode) | 61 if (mode_ == mode) |
| 61 return; | 62 return; |
| 62 mode_ = mode; | 63 mode_ = mode; |
| 63 OnSetMode(); | 64 OnSetMode(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 void UiTexture::OnSetMode() {} | 67 void UiTexture::OnSetMode() {} |
| 67 | 68 |
| 69 const ColorScheme& UiTexture::color_scheme() const { | |
| 70 return ColorScheme::GetColorScheme(mode()); | |
| 71 } | |
| 72 | |
| 68 std::vector<std::unique_ptr<gfx::RenderText>> UiTexture::PrepareDrawStringRect( | 73 std::vector<std::unique_ptr<gfx::RenderText>> UiTexture::PrepareDrawStringRect( |
| 69 const base::string16& text, | 74 const base::string16& text, |
| 70 const gfx::FontList& font_list, | 75 const gfx::FontList& font_list, |
| 71 SkColor color, | 76 SkColor color, |
| 72 gfx::Rect* bounds, | 77 gfx::Rect* bounds, |
| 73 UiTexture::TextAlignment text_alignment, | 78 UiTexture::TextAlignment text_alignment, |
| 74 UiTexture::WrappingBehavior wrapping_behavior) { | 79 UiTexture::WrappingBehavior wrapping_behavior) { |
| 75 DCHECK(bounds); | 80 DCHECK(bounds); |
| 76 | 81 |
| 77 std::vector<std::unique_ptr<gfx::RenderText>> lines; | 82 std::vector<std::unique_ptr<gfx::RenderText>> lines; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 fonts.push_back(gfx::Font(name, size)); | 201 fonts.push_back(gfx::Font(name, size)); |
| 197 *font_list = gfx::FontList(fonts); | 202 *font_list = gfx::FontList(fonts); |
| 198 return true; | 203 return true; |
| 199 } | 204 } |
| 200 | 205 |
| 201 void UiTexture::SetForceFontFallbackFailureForTesting(bool force) { | 206 void UiTexture::SetForceFontFallbackFailureForTesting(bool force) { |
| 202 force_font_fallback_failure_for_testing_ = force; | 207 force_font_fallback_failure_for_testing_ = force; |
| 203 } | 208 } |
| 204 | 209 |
| 205 } // namespace vr_shell | 210 } // namespace vr_shell |
| OLD | NEW |