summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authormgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-26 01:06:40 +0000
committermgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-26 01:06:40 +0000
commitec88fe61ba5c9a280405199218e90fc10bc3ee91 (patch)
treec38da0150c734ae2c0dcef3d73c512c67a165216 /ui
parentd63e8ae6294e138ee065aecf2134bb9bb757317f (diff)
downloadchromium_src-ec88fe61ba5c9a280405199218e90fc10bc3ee91.zip
chromium_src-ec88fe61ba5c9a280405199218e90fc10bc3ee91.tar.gz
chromium_src-ec88fe61ba5c9a280405199218e90fc10bc3ee91.tar.bz2
Remove unused font rendering code from pango_util.
This code has not been used since SVN 231992, where it was replaced with a Skia-based renderer. BUG=123104 Review URL: https://codereview.chromium.org/85113003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/pango_util.cc88
-rw-r--r--ui/gfx/pango_util.h43
2 files changed, 3 insertions, 128 deletions
diff --git a/ui/gfx/pango_util.cc b/ui/gfx/pango_util.cc
index 10bd253..c6f0b62 100644
--- a/ui/gfx/pango_util.cc
+++ b/ui/gfx/pango_util.cc
@@ -136,40 +136,6 @@ double GetPangoResolution() {
return resolution;
}
-void DrawTextOntoCairoSurface(cairo_t* cr,
- const base::string16& text,
- const gfx::Font& font,
- const gfx::Rect& bounds,
- const gfx::Rect& clip,
- SkColor text_color,
- int flags) {
- PangoLayout* layout = pango_cairo_create_layout(cr);
- base::i18n::TextDirection text_direction =
- base::i18n::GetFirstStrongCharacterDirection(text);
- DCHECK(!bounds.IsEmpty());
-
- gfx::SetupPangoLayout(
- layout, text, font, bounds.width(), text_direction, flags);
-
- pango_layout_set_height(layout, bounds.height() * PANGO_SCALE);
-
- cairo_save(cr);
- cairo_rectangle(cr, clip.x(), clip.y(), clip.width(), clip.height());
- cairo_clip(cr);
-
- int width = 0, height = 0;
- pango_layout_get_pixel_size(layout, &width, &height);
- Rect text_rect(bounds.x(), bounds.y(), width, height);
- // Vertically center |text_rect| in |bounds|.
- text_rect += gfx::Vector2d(0, (bounds.height() - text_rect.height()) / 2);
-
- DrawPangoLayout(cr, layout, font, bounds, text_rect,
- text_color, text_direction, flags);
-
- cairo_restore(cr);
- g_object_unref(layout);
-}
-
// Pass a width greater than 0 to force wrapping and eliding.
static void SetupPangoLayoutWithoutFont(
PangoLayout* layout,
@@ -297,60 +263,6 @@ void SetupPangoLayoutWithFontDescription(
pango_layout_set_font_description(layout, desc.get());
}
-void DrawPangoLayout(cairo_t* cr,
- PangoLayout* layout,
- const Font& font,
- const gfx::Rect& bounds,
- const gfx::Rect& text_rect,
- SkColor text_color,
- base::i18n::TextDirection text_direction,
- int flags) {
- double r = SkColorGetR(text_color) / 255.0,
- g = SkColorGetG(text_color) / 255.0,
- b = SkColorGetB(text_color) / 255.0,
- a = SkColorGetA(text_color) / 255.0;
-
- cairo_pattern_t* pattern = NULL;
-
- cairo_save(cr);
-
- // Use a fixed color.
- // Note: We do not elide (fade out the text) here, due to a bug in certain
- // Linux environments (http://crbug.com/123104).
- cairo_set_source_rgba(cr, r, g, b, a);
- cairo_move_to(cr, text_rect.x(), text_rect.y());
- pango_cairo_show_layout(cr, layout);
-
- if (font.GetStyle() & gfx::Font::UNDERLINE) {
- gfx::PlatformFontPango* platform_font =
- static_cast<gfx::PlatformFontPango*>(font.platform_font());
- DrawPangoTextUnderline(cr, platform_font, 0.0, text_rect);
- }
-
- if (pattern)
- cairo_pattern_destroy(pattern);
-
- cairo_restore(cr);
-}
-
-void DrawPangoTextUnderline(cairo_t* cr,
- gfx::PlatformFontPango* platform_font,
- double extra_edge_width,
- const Rect& text_rect) {
- const double underline_y =
- static_cast<double>(text_rect.y()) + text_rect.height() +
- platform_font->underline_position();
- cairo_set_line_width(
- cr, platform_font->underline_thickness() + 2 * extra_edge_width);
- cairo_move_to(cr,
- text_rect.x() - extra_edge_width,
- underline_y);
- cairo_line_to(cr,
- text_rect.x() + text_rect.width() + extra_edge_width,
- underline_y);
- cairo_stroke(cr);
-}
-
size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font) {
size_t size_in_pixels = pango_font_description_get_size(pango_font);
if (pango_font_description_get_size_is_absolute(pango_font)) {
diff --git a/ui/gfx/pango_util.h b/ui/gfx/pango_util.h
index 05c525a..db60c2e 100644
--- a/ui/gfx/pango_util.h
+++ b/ui/gfx/pango_util.h
@@ -50,32 +50,14 @@ class ScopedPangoFontDescription {
DISALLOW_COPY_AND_ASSIGN(ScopedPangoFontDescription);
};
-// Uses Pango to draw text onto |cr|. This is the public method for d
-void GFX_EXPORT DrawTextOntoCairoSurface(cairo_t* cr,
- const base::string16& text,
- const gfx::Font& font,
- const gfx::Rect& bounds,
- const gfx::Rect& clip,
- SkColor text_color,
- int flags);
-
// ----------------------------------------------------------------------------
// All other methods in this file are only to be used within the ui/ directory.
// They are shared with internal skia interfaces.
// ----------------------------------------------------------------------------
-// Setup pango |layout|; set the |text|, the font description based on |font|,
-// the |width| in PANGO_SCALE for RTL locale, the base |text_direction|,
-// alignment, ellipsis, word wrapping, resolution, etc.
-void SetupPangoLayout(PangoLayout* layout,
- const base::string16& text,
- const gfx::Font& font,
- int width,
- base::i18n::TextDirection text_direction,
- int flags);
-
-// Setup pango layout |layout| the same way as SetupPangoLayout(), except this
-// sets the font description based on |font_description|.
+// Setup pango |layout|; set the |text|, the font description based on
+// |font_description|, the |width| in PANGO_SCALE for RTL locale, the base
+// |text_direction|, alignment, ellipsis, word wrapping, resolution, etc.
void SetupPangoLayoutWithFontDescription(
PangoLayout* layout,
const base::string16& text,
@@ -84,25 +66,6 @@ void SetupPangoLayoutWithFontDescription(
base::i18n::TextDirection text_direction,
int flags);
-// Draws the |layout| (pango tuple of font, actual text, etc) onto |cr| using
-// |text_color| as the cairo pattern.
-void DrawPangoLayout(cairo_t* cr,
- PangoLayout* layout,
- const Font& font,
- const gfx::Rect& bounds,
- const gfx::Rect& text_rect,
- SkColor text_color,
- base::i18n::TextDirection text_direction,
- int flags);
-
-// Draw an underline under the text using |cr|, which must already be
-// initialized with the correct source. |extra_edge_width| is added to the
-// outer edge of the line.
-void DrawPangoTextUnderline(cairo_t* cr,
- gfx::PlatformFontPango* platform_font,
- double extra_edge_width,
- const Rect& text_rect);
-
// Returns the size in pixels for the specified |pango_font|.
size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font);