diff options
author | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-05 07:01:53 +0000 |
---|---|---|
committer | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-05 07:01:53 +0000 |
commit | 396cc643e6f57a0e8d222986c7105c42bf0d613e (patch) | |
tree | 7afd51675c832bc124ff10e76b00c21846f77936 | |
parent | e12888f1f79c6ba839b5eb8bf23a85140a4bdc6a (diff) | |
download | chromium_src-396cc643e6f57a0e8d222986c7105c42bf0d613e.zip chromium_src-396cc643e6f57a0e8d222986c7105c42bf0d613e.tar.gz chromium_src-396cc643e6f57a0e8d222986c7105c42bf0d613e.tar.bz2 |
Merge 232034 "pango_util: DrawPangoLayout no longer fades out th..."
> pango_util: DrawPangoLayout no longer fades out the text.
>
> As of r231992, this code is no longer used, so this CL is just for the
> purpose of merging back into M31.
>
> This affects tab rendering on Linux GTK. In certain Linux environments,
> the text fade is causing the title to be missing entirely. Therefore,
> the fade effect is temporarily disabled.
>
> BUG=123104
>
> Review URL: https://codereview.chromium.org/50533003
TBR=mgiuca@chromium.org
Review URL: https://codereview.chromium.org/59133002
git-svn-id: svn://svn.chromium.org/chrome/branches/1650/src@232938 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/gfx/pango_util.cc | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/ui/gfx/pango_util.cc b/ui/gfx/pango_util.cc index 3f96d4b..10bd253 100644 --- a/ui/gfx/pango_util.cc +++ b/ui/gfx/pango_util.cc @@ -34,13 +34,6 @@ namespace { // Marker for accelerators in the text. const gunichar kAcceleratorChar = '&'; -// Multiply by the text height to determine how much text should be faded -// when elliding. -const double kFadeWidthFactor = 1.5; - -// End state of the elliding fade. -const double kFadeFinalAlpha = 0.15; - // Return |cairo_font_options|. If needed, allocate and update it. // TODO(derat): Return font-specific options: http://crbug.com/125235 cairo_font_options_t* GetCairoFontOptions() { @@ -321,28 +314,10 @@ void DrawPangoLayout(cairo_t* cr, cairo_save(cr); - // If we're not eliding, use a fixed color. - // Otherwise, create a gradient pattern to use as the source. - if (text_direction == base::i18n::RIGHT_TO_LEFT || - (flags & gfx::Canvas::NO_ELLIPSIS) || - text_rect.width() <= bounds.width()) { - cairo_set_source_rgba(cr, r, g, b, a); - } else { - // Fade to semi-transparent to elide. - int fade_width = static_cast<double>(text_rect.height()) * kFadeWidthFactor; - if (fade_width > bounds.width() / 2) { - // Don't fade more than half the text. - fade_width = bounds.width() / 2; - } - int fade_x = bounds.x() + bounds.width() - fade_width; - - pattern = cairo_pattern_create_linear( - fade_x, bounds.y(), bounds.x() + bounds.width(), bounds.y()); - cairo_pattern_add_color_stop_rgba(pattern, 0, r, g, b, a); - cairo_pattern_add_color_stop_rgba(pattern, 1, r, g, b, kFadeFinalAlpha); - cairo_set_source(cr, pattern); - } - + // 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); |