summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-27 01:54:18 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-27 01:54:18 +0000
commit10e1e08a564ba1e9d3256d22b497c3d6fd004e4d (patch)
treefe02de27494c27b3dba35ea4eeefc23fee76f770 /ui
parent7d08b4a81dce3eb9d6e634aa45ac532f6772aa12 (diff)
downloadchromium_src-10e1e08a564ba1e9d3256d22b497c3d6fd004e4d.zip
chromium_src-10e1e08a564ba1e9d3256d22b497c3d6fd004e4d.tar.gz
chromium_src-10e1e08a564ba1e9d3256d22b497c3d6fd004e4d.tar.bz2
Change RenderTextWin to use SetFontFamilyWithStyle().
BUG=none TEST=none Review URL: http://codereview.chromium.org/9809020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/render_text.cc27
-rw-r--r--ui/gfx/render_text.h2
-rw-r--r--ui/gfx/render_text_win.cc3
3 files changed, 1 insertions, 31 deletions
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 791fe13..f96d6b4 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -216,33 +216,6 @@ void SkiaTextRenderer::SetFontFamilyWithStyle(const std::string& family,
}
}
-void SkiaTextRenderer::SetFontStyle(int style) {
- SkTypeface::Style skia_style = ConvertFontStyleToSkiaTypefaceStyle(style);
- SkTypeface* current_typeface = paint_.getTypeface();
-
- if (current_typeface->style() == skia_style)
- return;
-
- SkAutoTUnref<SkTypeface> typeface(
- SkTypeface::CreateFromTypeface(current_typeface, skia_style));
- if (typeface.get()) {
- // |paint_| adds its own ref. So don't |release()| it from the ref ptr here.
- SetTypeface(typeface.get());
- }
-}
-
-void SkiaTextRenderer::SetFont(const gfx::Font& font) {
- SkTypeface::Style skia_style =
- ConvertFontStyleToSkiaTypefaceStyle(font.GetStyle());
- SkAutoTUnref<SkTypeface> typeface(
- SkTypeface::CreateFromName(font.GetFontName().c_str(), skia_style));
- if (typeface.get()) {
- // |paint_| adds its own ref. So don't |release()| it from the ref ptr here.
- SetTypeface(typeface.get());
- }
- SetTextSize(font.GetFontSize());
-}
-
void SkiaTextRenderer::SetForegroundColor(SkColor foreground) {
paint_.setColor(foreground);
}
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 1118e80..0d45bb9 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -41,9 +41,7 @@ class SkiaTextRenderer {
void SetFontSmoothingSettings(bool enable_smoothing, bool enable_lcd_text);
void SetTypeface(SkTypeface* typeface);
void SetTextSize(int size);
- void SetFont(const gfx::Font& font);
void SetFontFamilyWithStyle(const std::string& family, int font_style);
- void SetFontStyle(int font_style);
void SetForegroundColor(SkColor foreground);
void SetShader(SkShader* shader);
void DrawSelection(const std::vector<Rect>& selection, SkColor color);
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
index d4e4e15..978be3d 100644
--- a/ui/gfx/render_text_win.cc
+++ b/ui/gfx/render_text_win.cc
@@ -486,8 +486,7 @@ void RenderTextWin::DrawVisualText(Canvas* canvas) {
glyph_x += SkIntToScalar(run->advance_widths[glyph]);
}
- renderer.SetFont(run->font);
- renderer.SetFontStyle(run->font_style);
+ renderer.SetFontFamilyWithStyle(run->font.GetFontName(), run->font_style);
renderer.SetForegroundColor(run->foreground);
renderer.DrawPosText(&pos[0], run->glyphs.get(), run->glyph_count);
// TODO(oshima|msw): Consider refactoring StyleRange into Style