[Libreoffice-commits] core.git: filter/source

Rohan Kumar rohankanojia420 at gmail.com
Mon Jan 23 17:16:05 UTC 2017


 filter/source/svg/presentation_engine.js |   40 +++++++++++++++----------------
 1 file changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 30672569d5576e86ea47e92c8bcb40416ebadd7c
Author: Rohan Kumar <rohankanojia420 at gmail.com>
Date:   Thu Jan 12 02:44:12 2017 +0530

    Remove aTransitionSubtypeOutMap and aTransitionTypeOutMap
    
    reverse mapping can be done at run time
    
    Change-Id: Id04688ffb62cfa494d0eeaf6b73feb5ade58d53c
    Reviewed-on: https://gerrit.libreoffice.org/32903
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index df69b14..14017ab 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -1886,6 +1886,20 @@ function Rectangle( aSVGRectElem )
     this.bottom = y + height;
 }
 
+/*
+ * Returns key corresponding to a value in object, null otherwise.
+ *
+ * @param Object
+ * @param value
+ */
+function getKeyByValue(aObj, value) {
+  for(var key in aObj) {
+    if(aObj[key] == value)
+      return key;
+  }
+  return null;
+}
+
 function log( message )
 {
     if( typeof console == 'object' )
@@ -5164,14 +5178,9 @@ aTransitionTypeInMap = {
     'irisWipe'          : IRISWIPE_TRANSITION
 };
 
-aTransitionTypeOutMap = [ '', 'barWipe', 'boxWipe', 'fourBoxWipe', 'ellipseWipe',
-                          'clockWipe', 'pinWheelWipe', 'pushWipe', 'slideWipe',
-                          'fade', 'randomBarWipe', 'checkerBoardWipe', 'dissolve' , 'irisWipe'];
-
-
 /*
  * All Transition subtypes should be in sync with aTransitionSubtypeInMap:
- * Comments '//' followed by integers represent the transition values in their 
+ * Comments '//' followed by integers represent the transition values in their
  * C++ implementations.
  */
 // Transition Subtypes
@@ -5256,16 +5265,6 @@ aTransitionSubtypeInMap = {
     'leftCenter'        : LEFTCENTER_TRANS_SUBTYPE
 };
 
-aTransitionSubtypeOutMap = [ 'default', 'leftToRight', 'topToBottom', 'cornersIn',
-                             'cornersOut', 'vertical', 'horizontal', 'down', 'circle',
-                             'clockwiseTwelve', 'clockwiseThree', 'clockwiseSix',
-                             'clockwiseNine', 'twoBladeVertical', 'twoBladeHorizontal',
-                             'fourBlade', 'fromLeft', 'fromTop', 'fromRight',
-                             'fromBottom', 'crossfade', 'fadeToColor', 'fadeFromColor',
-                             'fadeOverColor', 'threeBlade', 'eightBlade', 'oneBlade',
-                             'across', 'rectangle', 'diamond'];
-
-
 // Transition Modes
 TRANSITION_MODE_IN  = 1;
 TRANSITION_MODE_OUT = 0;
@@ -8246,10 +8245,10 @@ AnimationTransitionFilterNode.prototype.info = function( bVerbose )
     if( bVerbose )
     {
         // transition type
-        sInfo += ';  type: ' + aTransitionTypeOutMap[ String( this.getTransitionType() ) ];
+        sInfo += ';  type: ' + getKeyByValue(aTransitionTypeInMap, this.getTransitionType());
 
         // transition subtype
-        sInfo += ';  subtype: ' + aTransitionSubtypeOutMap[ this.getTransitionSubType() ];
+        sInfo += ';  subtype: ' + getKeyByValue(aTransitionSubtypeInMap, this.getTransitionSubType());
 
         // transition direction
         if( this.getReverseDirection() )
@@ -11090,10 +11089,10 @@ SlideTransition.prototype.info = function()
 
     var sInfo ='slide transition <' + this.sSlideId + '>: ';
     // transition type
-    sInfo += ';  type: ' + aTransitionTypeOutMap[ String( this.getTransitionType() ) ];
+    sInfo += ';  type: ' + getKeyByValue(aTransitionTypeInMap, this.getTransitionType());
 
     // transition subtype
-    sInfo += ';  subtype: ' + aTransitionSubtypeOutMap[ this.getTransitionSubType() ];
+    sInfo += ';  subtype: ' + getKeyByValue(aTransitionSubtypeInMap, this.getTransitionSubType());
 
     // transition direction
     if( !this.isDirectionForward() )
@@ -15022,6 +15021,7 @@ ElapsedTime.prototype.getElapsedTimeImpl = function()
 };
 
 
+
 /*****
  * @libreofficeend
  *


More information about the Libreoffice-commits mailing list