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

Unified Diff: ui/gfx/platform_font_linux.cc

Issue 1939143002: Remove all uses of skia::RefPtr and stale includes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/platform_font_linux.cc
diff --git a/ui/gfx/platform_font_linux.cc b/ui/gfx/platform_font_linux.cc
index dba65947477f9f4fd96bc975bbfd79b1a4805266..105e3dccb3b84ab63bba64171a8c65ce50b586bb 100644
--- a/ui/gfx/platform_font_linux.cc
+++ b/ui/gfx/platform_font_linux.cc
@@ -41,7 +41,7 @@ base::LazyInstance<scoped_refptr<PlatformFontLinux>>::Leaky g_default_font =
// Creates a SkTypeface for the passed-in Font::FontStyle and family. If a
// fallback typeface is used instead of the requested family, |family| will be
// updated to contain the fallback's family name.
-skia::RefPtr<SkTypeface> CreateSkTypeface(int style, std::string* family) {
+sk_sp<SkTypeface> CreateSkTypeface(int style, std::string* family) {
DCHECK(family);
int skia_style = SkTypeface::kNormal;
@@ -50,12 +50,12 @@ skia::RefPtr<SkTypeface> CreateSkTypeface(int style, std::string* family) {
if (Font::ITALIC & style)
skia_style |= SkTypeface::kItalic;
- skia::RefPtr<SkTypeface> typeface = skia::AdoptRef(SkTypeface::CreateFromName(
+ sk_sp<SkTypeface> typeface(SkTypeface::CreateFromName(
family->c_str(), static_cast<SkTypeface::Style>(skia_style)));
if (!typeface) {
// A non-scalable font such as .pcf is specified. Fall back to a default
// scalable font.
- typeface = skia::AdoptRef(SkTypeface::CreateFromName(
+ typeface = sk_sp<SkTypeface>(SkTypeface::CreateFromName(
kFallbackFontFamilyName, static_cast<SkTypeface::Style>(skia_style)));
CHECK(typeface) << "Could not find any font: " << family << ", "
<< kFallbackFontFamilyName;
@@ -116,7 +116,7 @@ PlatformFontLinux::PlatformFontLinux(const std::string& font_name,
query.families.push_back(font_name);
query.pixel_size = font_size_pixels;
query.style = Font::NORMAL;
- InitFromDetails(skia::RefPtr<SkTypeface>(), font_name, font_size_pixels,
+ InitFromDetails(nullptr, font_name, font_size_pixels,
query.style, gfx::GetFontRenderParams(query, NULL));
}
@@ -145,7 +145,7 @@ Font PlatformFontLinux::DeriveFont(int size_delta, int style) const {
// If the style changed, we may need to load a new face.
std::string new_family = font_family_;
- skia::RefPtr<SkTypeface> typeface =
+ sk_sp<SkTypeface> typeface =
(style == style_) ? typeface_ : CreateSkTypeface(style, &new_family);
FontRenderParamsQuery query;
@@ -212,7 +212,7 @@ const FontRenderParams& PlatformFontLinux::GetFontRenderParams() {
////////////////////////////////////////////////////////////////////////////////
// PlatformFontLinux, private:
-PlatformFontLinux::PlatformFontLinux(const skia::RefPtr<SkTypeface>& typeface,
+PlatformFontLinux::PlatformFontLinux(sk_sp<SkTypeface> typeface,
const std::string& family,
int size_pixels,
int style,
@@ -223,7 +223,7 @@ PlatformFontLinux::PlatformFontLinux(const skia::RefPtr<SkTypeface>& typeface,
PlatformFontLinux::~PlatformFontLinux() {}
void PlatformFontLinux::InitFromDetails(
- const skia::RefPtr<SkTypeface>& typeface,
+ sk_sp<SkTypeface> typeface,
const std::string& font_family,
int font_size_pixels,
int style,

Powered by Google App Engine
This is Rietveld 408576698