Revision: 7372
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7372&view=rev
Author:   evilguru
Date:     2009-08-05 15:26:30 +0000 (Wed, 05 Aug 2009)

Log Message:
-----------
Enable caching for mathtex expressions. This delivers a big performance boost 
when panning/zooming.

Modified Paths:
--------------
    branches/mathtex/lib/matplotlib/backends/backend_agg.py
    branches/mathtex/lib/matplotlib/backends/backend_cairo.py
    branches/mathtex/lib/matplotlib/backends/backend_gdk.py
    branches/mathtex/lib/matplotlib/backends/backend_macosx.py
    branches/mathtex/lib/matplotlib/backends/backend_pdf.py
    branches/mathtex/lib/matplotlib/backends/backend_ps.py

Modified: branches/mathtex/lib/matplotlib/backends/backend_agg.py
===================================================================
--- branches/mathtex/lib/matplotlib/backends/backend_agg.py     2009-08-05 
15:14:35 UTC (rev 7371)
+++ branches/mathtex/lib/matplotlib/backends/backend_agg.py     2009-08-05 
15:26:30 UTC (rev 7372)
@@ -111,7 +111,7 @@
                                      'debug-annoying')
         if HAVE_MATHTEX:
             m = Mathtex(s, rcParams['mathtext.fontset'], 
prop.get_size_in_points(),
-                        self.dpi, rcParams['mathtext.default'])
+                        self.dpi, rcParams['mathtext.default'], cache=True)
             b = MathtexBackendImage()
 
             m.render_to_backend(b)
@@ -166,7 +166,7 @@
                 return 0.0, 0.0, 0.0
             else:
                 m = Mathtex(s, rcParams['mathtext.fontset'], 
prop.get_size_in_points(),
-                            self.dpi, rcParams['mathtext.default'])
+                            self.dpi, rcParams['mathtext.default'], cache=True)
                 return m.width, m.height, m.depth
         font = self._get_agg_font(prop)
         font.set_text(s, 0.0, flags=LOAD_FORCE_AUTOHINT)  # the width and 
height of unrotated string

Modified: branches/mathtex/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- branches/mathtex/lib/matplotlib/backends/backend_cairo.py   2009-08-05 
15:14:35 UTC (rev 7371)
+++ branches/mathtex/lib/matplotlib/backends/backend_cairo.py   2009-08-05 
15:26:30 UTC (rev 7372)
@@ -211,7 +211,7 @@
         ctx = gc.ctx
 
         m = Mathtex(s, rcParams['mathtext.fontset'], prop.get_size_in_points(),
-                    self.dpi, rcParams['mathtext.default'])
+                    self.dpi, rcParams['mathtext.default'], cache=True)
         b = MathtexBackendCairo()
         m.render_to_backend(b)
 
@@ -242,7 +242,7 @@
         if ismath:
             if HAVE_MATHTEX:
                 m = Mathtex(s, rcParams['mathtext.fontset'], 
prop.get_size_in_points(),
-                            self.dpi, rcParams['mathtext.default'])
+                            self.dpi, rcParams['mathtext.default'], cache=True)
                 return m.width, m.height, m.depth
             else:
                 warnings.warn('matplotlib was compiled without mathtex 
support. ' +

Modified: branches/mathtex/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- branches/mathtex/lib/matplotlib/backends/backend_gdk.py     2009-08-05 
15:14:35 UTC (rev 7371)
+++ branches/mathtex/lib/matplotlib/backends/backend_gdk.py     2009-08-05 
15:26:30 UTC (rev 7372)
@@ -167,7 +167,8 @@
             return
 
         m = Mathtex(s, matplotlib.rcParams['mathtext.fontset'],
-                    prop.get_size_in_points(), self.dpi, 
rcParams['mathtext.default'])
+                    prop.get_size_in_points(), self.dpi, 
rcParams['mathtext.default'],
+                    cache=True)
         b = MathtexBackendImage()
         m.render_to_backend(b)
 
@@ -318,7 +319,8 @@
                 return 0.0, 0.0, 0.0
             else:
                 m = Mathtex(s, matplotlib.rcParams['mathtext.fontset'],
-                            prop.get_size_in_points(), self.dpi, 
rcParams['mathtext.default'])
+                            prop.get_size_in_points(), self.dpi, 
rcParams['mathtext.default'],
+                            cache=True)
                 return m.width, m.height, m.depth
 
         layout, inkRect, logicalRect = self._get_pango_layout(s, prop)

Modified: branches/mathtex/lib/matplotlib/backends/backend_macosx.py
===================================================================
--- branches/mathtex/lib/matplotlib/backends/backend_macosx.py  2009-08-05 
15:14:35 UTC (rev 7371)
+++ branches/mathtex/lib/matplotlib/backends/backend_macosx.py  2009-08-05 
15:26:30 UTC (rev 7372)
@@ -98,7 +98,7 @@
             return
 
         m = Mathtex(s, rcParams['mathtext.fontset'], prop.get_size_in_points(),
-                    self.dpi, rcParams['mathtext.default'])
+                    self.dpi, rcParams['mathtext.default'], cache=True)
         b = MathtexBackendImage()
         m.render_to_backend(b)
 
@@ -126,7 +126,8 @@
         if ismath:
             if HAVE_MATHTEX:
                 m = Mathtex(s, rcParams['mathtext.fontset'],
-                            prop.get_size_in_points(), self.dpi, 
rcParams['mathtext.default'])
+                            prop.get_size_in_points(), self.dpi, 
rcParams['mathtext.default'],
+                            cache=True)
                 return m.width, m.height, m.depth
             else:
                 warnings.warn('matplotlib was compiled without mathtex 
support. ' +

Modified: branches/mathtex/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/mathtex/lib/matplotlib/backends/backend_pdf.py     2009-08-05 
15:14:35 UTC (rev 7371)
+++ branches/mathtex/lib/matplotlib/backends/backend_pdf.py     2009-08-05 
15:26:30 UTC (rev 7372)
@@ -1352,7 +1352,7 @@
             return
 
         m = Mathtex(s, rcParams['mathtext.fontset'], prop.get_size_in_points(),
-                    72.0, rcParams['mathtext.default'])
+                    72.0, rcParams['mathtext.default'], cache=True)
 
         # Generate the dict of used characters
         used_characters = {}
@@ -1669,7 +1669,8 @@
                 w, h, d = 0.0, 0.0, 0.0
             else:
                 m = Mathtex(s, rcParams['mathtext.fontset'],
-                            prop.get_size_in_points(), 72.0, 
rcParams['mathtext.default'])
+                            prop.get_size_in_points(), 72.0, 
rcParams['mathtext.default'],
+                            cache=True)
                 w, h, d = m.width, m.height, m.depth
 
         elif rcParams['pdf.use14corefonts']:

Modified: branches/mathtex/lib/matplotlib/backends/backend_ps.py
===================================================================
--- branches/mathtex/lib/matplotlib/backends/backend_ps.py      2009-08-05 
15:14:35 UTC (rev 7371)
+++ branches/mathtex/lib/matplotlib/backends/backend_ps.py      2009-08-05 
15:26:30 UTC (rev 7372)
@@ -283,7 +283,7 @@
         if ismath:
             if HAVE_MATHTEX:
                 m = Mathtex(s, rcParams['mathtext.fontset'], 
prop.get_size_in_points(),
-                            72.0, rcParams['mathtext.default'])
+                            72.0, rcParams['mathtext.default'], cache=True)
                 return m.width, m.height, m.depth
             else:
                 warnings.warn('matplotlib was compiled without mathtex 
support. ' +
@@ -752,7 +752,7 @@
             return
 
         m = Mathtex(s, rcParams['mathtext.fontset'], prop.get_size_in_points(),
-                    72.0, rcParams['mathtext.default'])
+                    72.0, rcParams['mathtext.default'], cache=True)
 
         # Generate the dict of used characters
         used_characters = {}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to