You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ga...@apache.org on 2013/01/16 21:54:50 UTC

svn commit: r1434386 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/complexscripts/fonts/

Author: gadams
Date: Wed Jan 16 20:54:49 2013
New Revision: 1434386

URL: http://svn.apache.org/viewvc?rev=1434386&view=rev
Log:
FOP-2186: optimize inefficient glyph processing state update operations

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java?rev=1434386&r1=1434385&r2=1434386&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java Wed Jan 16 20:54:49 2013
@@ -143,7 +143,6 @@ public class GlyphPositioningState exten
         assert st != null;
         updateSubtableState ( st );
         boolean applied = st.position ( this );
-        resetSubtableState();
         return applied;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java?rev=1434386&r1=1434385&r2=1434386&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java Wed Jan 16 20:54:49 2013
@@ -72,6 +72,8 @@ public class GlyphProcessingState {
     protected GlyphTester ignoreMark;
     /** default ignore glyph tester */
     protected GlyphTester ignoreDefault;
+    /** current subtable */
+    private GlyphSubtable subtable;
 
     /**
      * Construct glyph processing state.
@@ -181,18 +183,12 @@ public class GlyphProcessingState {
      * @param st glyph subtable to use for update
      */
     public void updateSubtableState ( GlyphSubtable st ) {
-        setGDEF ( st.getGDEF() );
-        setLookupFlags ( st.getFlags() );
-        setIgnoreDefault ( getIgnoreTester ( getLookupFlags() ) );
-    }
-
-    /**
-     * Reset glyph subtable specific state.
-     */
-    public void resetSubtableState() {
-        setGDEF ( null );
-        setLookupFlags ( 0 );
-        setIgnoreDefault ( null );
+        if ( this.subtable != st ) {
+            setGDEF ( st.getGDEF() );
+            setLookupFlags ( st.getFlags() );
+            setIgnoreDefault ( getIgnoreTester ( getLookupFlags() ) );
+            this.subtable = st;
+        }
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java?rev=1434386&r1=1434385&r2=1434386&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java Wed Jan 16 20:54:49 2013
@@ -162,7 +162,6 @@ public class GlyphSubstitutionState exte
         assert st != null;
         updateSubtableState ( st );
         boolean applied = st.substitute ( this );
-        resetSubtableState();
         return applied;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java?rev=1434386&r1=1434385&r2=1434386&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java Wed Jan 16 20:54:49 2013
@@ -435,7 +435,8 @@ public class GlyphTable {
      */
     public static class LookupTable implements Comparable {
 
-        private final String id;                                // lookup identifiers
+        private final String id;                                // lookup identifier
+        private final int idOrdinal;                            // parsed lookup identifier ordinal
         private final List/*<GlyphSubtable>*/ subtables;        // list of subtables
         private boolean doesSub;                                // performs substitutions
         private boolean doesPos;                                // performs positioning
@@ -461,7 +462,9 @@ public class GlyphTable {
         public LookupTable ( String id, List/*<GlyphSubtable>*/ subtables ) {
             assert id != null;
             assert id.length() != 0;
+            assert id.startsWith ( "lu" );
             this.id = id;
+            this.idOrdinal = Integer.parseInt ( id.substring ( 2 ) );
             this.subtables = new LinkedList/*<GlyphSubtable>*/();
             if ( subtables != null ) {
                 for ( Iterator it = subtables.iterator(); it.hasNext(); ) {
@@ -471,11 +474,6 @@ public class GlyphTable {
             }
         }
 
-        /** @return the identifier */
-        public String getId() {
-            return id;
-        }
-
         /** @return the subtables as an array */
         public GlyphSubtable[] getSubtables() {
             if ( frozen ) {
@@ -664,7 +662,7 @@ public class GlyphTable {
 
         /** {@inheritDoc} */
         public int hashCode() {
-            return id.hashCode();
+            return idOrdinal;
         }
 
         /**
@@ -675,7 +673,7 @@ public class GlyphTable {
         public boolean equals ( Object o ) {
             if ( o instanceof LookupTable ) {
                 LookupTable lt = (LookupTable) o;
-                return id.equals ( lt.id );
+                return idOrdinal == lt.idOrdinal;
             } else {
                 return false;
             }
@@ -691,10 +689,8 @@ public class GlyphTable {
         public int compareTo ( Object o ) {
             if ( o instanceof LookupTable ) {
                 LookupTable lt = (LookupTable) o;
-                assert id.startsWith ( "lu" );
-                int i = Integer.parseInt ( id.substring ( 2 ) );
-                assert lt.id.startsWith ( "lu" );
-                int j = Integer.parseInt ( lt.id.substring ( 2 ) );
+                int i = idOrdinal;
+                int j = lt.idOrdinal;
                 if ( i < j ) {
                     return -1;
                 } else if ( i > j ) {

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1434386&r1=1434385&r2=1434386&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Wed Jan 16 20:54:49 2013
@@ -59,6 +59,9 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="FOP-2186">
+       Optimize inefficient glyph processing state update operations in CS path.
+      </action>
       <action context="Renderers" dev="GA" type="fix" fixes-bug="FOP-2184" due-to="Luis Bernardo">
        Optimize inefficient position adjustment array allocation in non-CS path.
       </action>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org