mutter/clutter
Owen W. Taylor 4ef041371c text: correct caching logic
This patch combines a number of fixes and improvements to the
layout caching logic in ClutterText.

 * Fix: The width must always be set on the PangoLayout when painting.
   This is necessary because the layout aligns in the width, and
   even when we think we are left-aligned, the auto-dir feature
   of PangoLayout may result in right-alignment.

 * Fix: We should only ever try to reuse a cached layout based
   on its logical width if layout.width was -1 when computing
   that logical width. If the layout was already ellipsized,
   then comparing the logical width to the new width we are
   trying to wrap to doesn't make sense. (If "abc" ellipsizes
   to a 15-pixel wide "..." for a width of 1 pixel, that doesn't
   mean that we should use "..." for a width of 15 pixels. Maybe
   "abc" itself is 15 pixels wide.)

 * Improvement: rather than looking up cached layouts based on the
   input allocation_width/allocation_height, look them up based
   on the actual width/height/ellipsize that we pass to create
   a layout. This is simpler and improves the chance we'll get
   a cache hit when appropriate even if there are small floating
   point differences.

Note because of the first fix this is less aggressive than dd40732
in caching layouts; get_preferred_width() and painting can't share
a layout since get_preferred_width() needs to pass a width of -1
to Pango and painting needs to pass the real width.

The patch has been updated from the clutter-1.2 branch to current
master; using the profiling instrumentation it is possible to verify
with test-text-field that the hit/miss counters go from:

   Name                                   Total Per Frame
   ----                                   ----- ---------
   Text layout cache hit counter          13    6
   Text layout cache miss counter         11    5

before applying the patch, to:

   Name                                   Total Per Frame
   ----                                   ----- ---------
   Text layout cache miss counter         4     2
   Text layout cache hit counter          3     1

after applying the patch.

https://bugzilla.gnome.org/show_bug.cgi?id=618104

http://bugzilla.openedhand.com/show_bug.cgi?id=2109

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-05-11 12:22:30 +01:00
..
cogl
eglnative
eglx
fruity
glx
json
osx
win32
x11
clutter-actor.c
clutter-actor.h
clutter-alpha.c
clutter-alpha.h
clutter-animatable.c [animatable] Allow validation in ::animate_property 2009-05-27 13:01:31 +01:00
clutter-animatable.h
clutter-animation.c
clutter-animation.h
clutter-animator.c
clutter-animator.h
clutter-backend.c
clutter-backend.h
clutter-behaviour-depth.c
clutter-behaviour-depth.h
clutter-behaviour-ellipse.c
clutter-behaviour-ellipse.h
clutter-behaviour-opacity.c
clutter-behaviour-opacity.h
clutter-behaviour-path.c
clutter-behaviour-path.h
clutter-behaviour-rotate.c
clutter-behaviour-rotate.h Remove the last few fixed-point entry points 2009-06-19 16:38:35 +01:00
clutter-behaviour-scale.c
clutter-behaviour-scale.h
clutter-behaviour.c
clutter-behaviour.h
clutter-bezier.c
clutter-bezier.h
clutter-bin-layout.c
clutter-bin-layout.h
clutter-binding-pool.c
clutter-binding-pool.h
clutter-box-layout.c
clutter-box-layout.h
clutter-box.c
clutter-box.h
clutter-cairo-texture.c
clutter-cairo-texture.h
clutter-child-meta.c
clutter-child-meta.h [docs] Bring down the undocumented symbols to 2% 2009-03-16 15:00:55 +00:00
clutter-clone.c
clutter-clone.h
clutter-color.c
clutter-color.h
clutter-container.c
clutter-container.h
clutter-debug.h
clutter-deprecated.h
clutter-device-manager.c
clutter-device-manager.h
clutter-enum-types.c.in
clutter-enum-types.h.in
clutter-event.c
clutter-event.h
clutter-feature.c
clutter-feature.h
clutter-fixed-layout.c
clutter-fixed-layout.h
clutter-fixed.c
clutter-fixed.h
clutter-flow-layout.c
clutter-flow-layout.h
clutter-frame-source.c
clutter-frame-source.h
clutter-group.c
clutter-group.h
clutter-id-pool.c
clutter-id-pool.h 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com> 2008-10-30 17:04:34 +00:00
clutter-input-device.c
clutter-input-device.h device: Allow updating devices from embedding toolkits 2010-02-17 18:21:50 +00:00
clutter-interval.c
clutter-interval.h
clutter-json.h.in
clutter-keysyms-table.h
clutter-keysyms.h
clutter-layout-manager.c
clutter-layout-manager.h
clutter-layout-meta.c
clutter-layout-meta.h
clutter-list-model.c
clutter-list-model.h
clutter-main.c
clutter-main.h
clutter-marshal.list
clutter-master-clock.c
clutter-master-clock.h
clutter-media.c
clutter-media.h
clutter-model-private.h
clutter-model.c
clutter-model.h
clutter-path.c
clutter-path.h
clutter-private.h
clutter-profile.c
clutter-profile.h
clutter-rectangle.c
clutter-rectangle.h
clutter-score.c
clutter-score.h
clutter-script-parser.c
clutter-script-private.h
clutter-script.c Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
clutter-script.h
clutter-scriptable.c
clutter-scriptable.h
clutter-shader-types.c
clutter-shader-types.h
clutter-shader.c
clutter-shader.h
clutter-stage-manager.c
clutter-stage-manager.h
clutter-stage-window.c
clutter-stage-window.h
clutter-stage.c
clutter-stage.h
clutter-text.c text: correct caching logic 2010-05-11 12:22:30 +01:00
clutter-text.h
clutter-texture.c
clutter-texture.h
clutter-timeline.c
clutter-timeline.h
clutter-timeout-interval.c
clutter-timeout-interval.h
clutter-timeout-pool.c
clutter-timeout-pool.h
clutter-types.h
clutter-units.c
clutter-units.h
clutter-util.c
clutter-util.h
clutter-version.h.in
clutter.h
Makefile.am