| 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 static constexpr char kDefaultFontFamily[] = "sans-serif"; | 26 static constexpr char kDefaultFontFamily[] = "sans-serif"; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 UiTexture::UiTexture() = default; | 30 UiTexture::UiTexture() = default; |
| 31 | 31 |
| 32 UiTexture::~UiTexture() = default; | 32 UiTexture::~UiTexture() = default; |
| 33 | 33 |
| 34 bool UiTexture::SetDrawFlags(int draw_flags) { |
| 35 if (draw_flags == draw_flags_) |
| 36 return false; |
| 37 draw_flags_ = draw_flags; |
| 38 return true; |
| 39 } |
| 40 |
| 34 void UiTexture::DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size) { | 41 void UiTexture::DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size) { |
| 35 canvas->drawColor(SK_ColorTRANSPARENT); | 42 canvas->drawColor(SK_ColorTRANSPARENT); |
| 36 Draw(canvas, texture_size); | 43 Draw(canvas, texture_size); |
| 37 } | 44 } |
| 38 | 45 |
| 39 bool UiTexture::IsRTL() { | 46 bool UiTexture::IsRTL() { |
| 40 return base::i18n::IsRTL(); | 47 return base::i18n::IsRTL(); |
| 41 } | 48 } |
| 42 | 49 |
| 43 gfx::FontList UiTexture::GetDefaultFontList(int size) { | 50 gfx::FontList UiTexture::GetDefaultFontList(int size) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 71 std::string name(sk_name.c_str()); | 78 std::string name(sk_name.c_str()); |
| 72 if (name != kDefaultFontFamily) | 79 if (name != kDefaultFontFamily) |
| 73 names.insert(name); | 80 names.insert(name); |
| 74 } | 81 } |
| 75 for (const auto& name : names) | 82 for (const auto& name : names) |
| 76 fonts.push_back(gfx::Font(name, size)); | 83 fonts.push_back(gfx::Font(name, size)); |
| 77 return gfx::FontList(fonts); | 84 return gfx::FontList(fonts); |
| 78 } | 85 } |
| 79 | 86 |
| 80 } // namespace vr_shell | 87 } // namespace vr_shell |
| OLD | NEW |