Re: Trivial patch reducing fp mults in pango-cairo



Humm, I hate to say this, but the patch makes absolutely no difference
in any real test case.  In fact, none of those two lines are run on real
world scenarios:

On Sat, 2006-12-09 at 20:22 +0200, Jorn Baayen wrote:
> Index: pango/pangocairo-fcfont.c
> ===================================================================
> RCS file: /cvs/gnome/pango/pango/pangocairo-fcfont.c,v
> retrieving revision 1.46
> diff -u -r1.46 pangocairo-fcfont.c
> --- pango/pangocairo-fcfont.c   28 Nov 2006 21:17:39 -0000      1.46
> +++ pango/pangocairo-fcfont.c   9 Dec 2006 15:35:30 -0000
> @@ -309,7 +309,7 @@
>         break;
>        case PANGO_GRAVITY_EAST:
>        case PANGO_GRAVITY_WEST:
> -        cffont->font_extents.y = - PANGO_UNITS ((font_extents.ascent
> + font_extents.descent) * 0.5);
> +        cffont->font_extents.y = - PANGO_UNITS ((font_extents.ascent
> + font_extents.descent) / 2);
>      }

First, this is only relevant in East and West gravities.  That is,
vertical text.  Moreover, it will run like once per font.  Finally, all
you are doing here is replacing double multiplication with double
division!  Yes, font_extents members are all double.


>    cffont->glyph_extents_cache = g_new0 (GlyphExtentsCacheEntry,
> GLYPH_CACHE_NUM_ENTRIES);
> Index: pango/pangocairo-font.c
> ===================================================================
> RCS file: /cvs/gnome/pango/pango/pangocairo-font.c,v
> retrieving revision 1.30
> diff -u -r1.30 pangocairo-font.c
> --- pango/pangocairo-font.c     28 Nov 2006 21:47:51 -0000      1.30
> +++ pango/pangocairo-font.c     9 Dec 2006 15:35:31 -0000
> @@ -202,7 +202,7 @@
>      fontmap = pango_font_get_font_map ((PangoFont *)cfont);
>  
>      desc = pango_font_describe_with_absolute_size ((PangoFont
> *)cfont);
> -    size = pango_font_description_get_size (desc) / (1.*PANGO_SCALE);
> +    size = pango_font_description_get_size (desc) / (double)
> PANGO_SCALE;

This will only run for hexboxes.  Once per font.  And it should make any
difference with any decent compiler.

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]