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

Side by Side Diff: ui/gfx/platform_font_linux.h

Issue 1939143002: Remove all uses of skia::RefPtr and stale includes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad rebase Created 4 years, 7 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
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/gfx/platform_font_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_GFX_PLATFORM_FONT_LINUX_H_ 5 #ifndef UI_GFX_PLATFORM_FONT_LINUX_H_
6 #define UI_GFX_PLATFORM_FONT_LINUX_H_ 6 #define UI_GFX_PLATFORM_FONT_LINUX_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "skia/ext/refptr.h"
15 #include "third_party/skia/include/core/SkRefCnt.h" 14 #include "third_party/skia/include/core/SkRefCnt.h"
16 #include "ui/gfx/font_render_params.h" 15 #include "ui/gfx/font_render_params.h"
17 #include "ui/gfx/platform_font.h" 16 #include "ui/gfx/platform_font.h"
18 17
19 class SkTypeface; 18 class SkTypeface;
20 class SkPaint; 19 class SkPaint;
21 20
22 namespace gfx { 21 namespace gfx {
23 22
24 class GFX_EXPORT PlatformFontLinux : public PlatformFont { 23 class GFX_EXPORT PlatformFontLinux : public PlatformFont {
(...skipping 23 matching lines...) Expand all
48 int GetExpectedTextWidth(int length) override; 47 int GetExpectedTextWidth(int length) override;
49 int GetStyle() const override; 48 int GetStyle() const override;
50 const std::string& GetFontName() const override; 49 const std::string& GetFontName() const override;
51 std::string GetActualFontNameForTesting() const override; 50 std::string GetActualFontNameForTesting() const override;
52 int GetFontSize() const override; 51 int GetFontSize() const override;
53 const FontRenderParams& GetFontRenderParams() override; 52 const FontRenderParams& GetFontRenderParams() override;
54 53
55 private: 54 private:
56 // Create a new instance of this object with the specified properties. Called 55 // Create a new instance of this object with the specified properties. Called
57 // from DeriveFont. 56 // from DeriveFont.
58 PlatformFontLinux(const skia::RefPtr<SkTypeface>& typeface, 57 PlatformFontLinux(sk_sp<SkTypeface> typeface,
59 const std::string& family, 58 const std::string& family,
60 int size_pixels, 59 int size_pixels,
61 int style, 60 int style,
62 const FontRenderParams& params); 61 const FontRenderParams& params);
63 ~PlatformFontLinux() override; 62 ~PlatformFontLinux() override;
64 63
65 // Initializes this object based on the passed-in details. If |typeface| is 64 // Initializes this object based on the passed-in details. If |typeface| is
66 // empty, a new typeface will be loaded. 65 // empty, a new typeface will be loaded.
67 void InitFromDetails( 66 void InitFromDetails(
68 const skia::RefPtr<SkTypeface>& typeface, 67 sk_sp<SkTypeface> typeface,
69 const std::string& font_family, 68 const std::string& font_family,
70 int font_size_pixels, 69 int font_size_pixels,
71 int style, 70 int style,
72 const FontRenderParams& params); 71 const FontRenderParams& params);
73 72
74 // Initializes this object as a copy of another PlatformFontLinux. 73 // Initializes this object as a copy of another PlatformFontLinux.
75 void InitFromPlatformFont(const PlatformFontLinux* other); 74 void InitFromPlatformFont(const PlatformFontLinux* other);
76 75
77 // Computes the metrics if they have not yet been computed. 76 // Computes the metrics if they have not yet been computed.
78 void ComputeMetricsIfNecessary(); 77 void ComputeMetricsIfNecessary();
79 78
80 skia::RefPtr<SkTypeface> typeface_; 79 sk_sp<SkTypeface> typeface_;
81 80
82 // Additional information about the face. 81 // Additional information about the face.
83 // Skia actually expects a family name and not a font name. 82 // Skia actually expects a family name and not a font name.
84 std::string font_family_; 83 std::string font_family_;
85 int font_size_pixels_; 84 int font_size_pixels_;
86 int style_; 85 int style_;
87 float device_scale_factor_; 86 float device_scale_factor_;
88 87
89 // Information describing how the font should be rendered. 88 // Information describing how the font should be rendered.
90 FontRenderParams font_render_params_; 89 FontRenderParams font_render_params_;
91 90
92 // Cached metrics, generated on demand. 91 // Cached metrics, generated on demand.
93 bool metrics_need_computation_ = true; 92 bool metrics_need_computation_ = true;
94 int ascent_pixels_; 93 int ascent_pixels_;
95 int height_pixels_; 94 int height_pixels_;
96 int cap_height_pixels_; 95 int cap_height_pixels_;
97 double average_width_pixels_; 96 double average_width_pixels_;
98 97
99 #if defined(OS_CHROMEOS) 98 #if defined(OS_CHROMEOS)
100 // A font description string of the format used by gfx::FontList. 99 // A font description string of the format used by gfx::FontList.
101 static std::string* default_font_description_; 100 static std::string* default_font_description_;
102 #endif 101 #endif
103 102
104 DISALLOW_COPY_AND_ASSIGN(PlatformFontLinux); 103 DISALLOW_COPY_AND_ASSIGN(PlatformFontLinux);
105 }; 104 };
106 105
107 } // namespace gfx 106 } // namespace gfx
108 107
109 #endif // UI_GFX_PLATFORM_FONT_LINUX_H_ 108 #endif // UI_GFX_PLATFORM_FONT_LINUX_H_
OLDNEW
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/gfx/platform_font_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698