| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 constexpr char kDefaultFontFamily[] = "sans-serif"; | 25 constexpr char kDefaultFontFamily[] = "sans-serif"; |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 UiTexture::UiTexture() = default; | 28 UiTexture::UiTexture() = default; |
| 29 | 29 |
| 30 UiTexture::~UiTexture() = default; | 30 UiTexture::~UiTexture() = default; |
| 31 | 31 |
| 32 void UiTexture::DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size) { | 32 void UiTexture::DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size) { |
| 33 cc::SkiaPaintCanvas paint_canvas(canvas); | 33 canvas->drawColor(SK_ColorTRANSPARENT); |
| 34 gfx::Canvas gfx_canvas(&paint_canvas, 1.0f); | 34 Draw(canvas, texture_size); |
| 35 gfx_canvas.DrawColor(SK_ColorTRANSPARENT); | |
| 36 Draw(&gfx_canvas, texture_size); | |
| 37 } | 35 } |
| 38 | 36 |
| 39 bool UiTexture::IsRTL() { | 37 bool UiTexture::IsRTL() { |
| 40 return base::i18n::IsRTL(); | 38 return base::i18n::IsRTL(); |
| 41 } | 39 } |
| 42 | 40 |
| 43 gfx::FontList UiTexture::GetFontList(int size, base::string16 text) { | 41 gfx::FontList UiTexture::GetFontList(int size, base::string16 text) { |
| 44 gfx::Font default_font(kDefaultFontFamily, size); | 42 gfx::Font default_font(kDefaultFontFamily, size); |
| 45 std::vector<gfx::Font> fonts{default_font}; | 43 std::vector<gfx::Font> fonts{default_font}; |
| 46 | 44 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 67 std::string name(sk_name.c_str()); | 65 std::string name(sk_name.c_str()); |
| 68 if (name != kDefaultFontFamily) | 66 if (name != kDefaultFontFamily) |
| 69 names.insert(name); | 67 names.insert(name); |
| 70 } | 68 } |
| 71 for (const auto& name : names) | 69 for (const auto& name : names) |
| 72 fonts.push_back(gfx::Font(name, size)); | 70 fonts.push_back(gfx::Font(name, size)); |
| 73 return gfx::FontList(fonts); | 71 return gfx::FontList(fonts); |
| 74 } | 72 } |
| 75 | 73 |
| 76 } // namespace vr_shell | 74 } // namespace vr_shell |
| OLD | NEW |