svg-export: animation sequence was wrong
Animation sequence was wrong due to the priority queue and related
compare functions implementation.
Change-Id: I359abd087e922ffa0aa4f7770fcc0c9bdb029843
Reviewed-on: https://gerrit.libreoffice.org/20236
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index e4fe52e..f6426dc 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -3776,7 +3776,6 @@ function PriorityQueue( aCompareFunc )
{
this.aSequence = new Array();
this.aCompareFunc = aCompareFunc;
this.bSorted = true;
}
PriorityQueue.prototype.clone = function()
@@ -3793,18 +3792,11 @@ PriorityQueue.prototype.clone = function()
}
}
aCopy.aSequence = dest;
aCopy.bSorted = this.bSorted;
return aCopy;
};
PriorityQueue.prototype.top = function()
{
if( !this.bSorted )
{
this.aSequence.sort(this.aCompareFunc)
this.bSorted = true;
}
return this.aSequence[this.aSequence.length - 1];
};
@@ -3815,28 +3807,23 @@ PriorityQueue.prototype.isEmpty = function()
PriorityQueue.prototype.push = function( aValue )
{
this.bSorted = false;
this.aSequence.push( aValue );
this.aSequence.unshift( aValue );
this.aSequence.sort(this.aCompareFunc);
};
PriorityQueue.prototype.clear = function()
{
this.bSorted = true;
this.aSequence = new Array();
};
PriorityQueue.prototype.pop = function()
{
if( !this.bSorted )
{
this.aSequence.sort(this.aCompareFunc)
this.bSorted = true;
}
return this.aSequence.pop();
};
/**********************************************************************************************
* AnimationNode Class Hierarchy
**********************************************************************************************/
@@ -10353,17 +10340,30 @@ function PriorityEntry( aValue, nPriority )
* An instance of type PriorityEntry.
* @param aRhsEntry
* An instance of type PriorityEntry.
* @return {Boolean}
* True if the first entry has higher priority of the second entry,
* false otherwise.
* @return {Integer}
* -1 if the left entry has lower priority of the right entry,
* 1 if the left entry has higher priority of the right entry,
* 0 if the two entry have the same priority
*/
PriorityEntry.compare = function( aLhsEntry, aRhsEntry )
{
return ( aLhsEntry.nPriority < aRhsEntry.nPriority );
if ( aLhsEntry.nPriority < aRhsEntry.nPriority )
{
return -1;
}
else if (aLhsEntry.nPriority > aRhsEntry.nPriority)
{
return 1;
}
else
{
return 0;
}
};
function EventMultiplexer( aTimerEventQueue )
{
this.nId = EventMultiplexer.getUniqueId();
@@ -12907,7 +12907,18 @@ function EventEntry( aEvent, nTime )
EventEntry.compare = function( aLhsEventEntry, aRhsEventEntry )
{
return ( aLhsEventEntry.nActivationTime > aRhsEventEntry.nActivationTime );
if ( aLhsEventEntry.nActivationTime > aRhsEventEntry.nActivationTime )
{
return -1;
}
else if ( aLhsEventEntry.nActivationTime < aRhsEventEntry.nActivationTime )
{
return 1;
}
else
{
return 0;
}
};