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

Unified Diff: ui/gfx/render_text.cc

Issue 1907833002: RenderTextMac: Cache the SkTypeface on the TextRun (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skia::RefPtr<>(Adopt(..)) -> sk_sp<>(..) Created 4 years, 8 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
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_harfbuzz.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 29b2e8e3bf1d795b4d60b92b3a2dba1370814ac9..7019918df3959526af5504e2f57a75ee02ec8cd5 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -90,16 +90,6 @@ int DetermineBaselineCenteringText(const Rect& display_rect,
return baseline + std::max(min_shift, std::min(max_shift, baseline_shift));
}
-#if !defined(OS_MACOSX)
-// Converts |Font::FontStyle| flags to |SkTypeface::Style| flags.
-SkTypeface::Style ConvertFontStyleToSkiaTypefaceStyle(int font_style) {
- int skia_style = SkTypeface::kNormal;
- skia_style |= (font_style & Font::BOLD) ? SkTypeface::kBold : 0;
- skia_style |= (font_style & Font::ITALIC) ? SkTypeface::kItalic : 0;
- return static_cast<SkTypeface::Style>(skia_style);
-}
-#endif
-
int round(float value) {
return static_cast<int>(floor(value + 0.5f));
}
@@ -257,18 +247,6 @@ void SkiaTextRenderer::SetTextSize(SkScalar size) {
paint_.setTextSize(size);
}
-void SkiaTextRenderer::SetFontWithStyle(const Font& font, int style) {
- skia::RefPtr<SkTypeface> typeface = CreateSkiaTypeface(font, style);
- if (typeface) {
- // |paint_| adds its own ref. So don't |release()| it from the ref ptr here.
- SetTypeface(typeface.get());
-
- // Enable fake bold text if bold style is needed but new typeface does not
- // have it.
- paint_.setFakeBoldText((style & Font::BOLD) && !typeface->isBold());
- }
-}
-
void SkiaTextRenderer::SetForegroundColor(SkColor foreground) {
paint_.setColor(foreground);
}
@@ -423,14 +401,6 @@ Line::Line(const Line& other) = default;
Line::~Line() {}
-#if !defined(OS_MACOSX)
-skia::RefPtr<SkTypeface> CreateSkiaTypeface(const gfx::Font& font, int style) {
- SkTypeface::Style skia_style = ConvertFontStyleToSkiaTypefaceStyle(style);
- return skia::AdoptRef(
- SkTypeface::CreateFromName(font.GetFontName().c_str(), skia_style));
-}
-#endif
-
void ApplyRenderParams(const FontRenderParams& params,
bool subpixel_rendering_suppressed,
SkPaint* paint) {
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_harfbuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698