[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - filter/source
Marco Cecchetti
marco.cecchetti at collabora.com
Wed Dec 9 01:25:48 PST 2015
filter/source/svg/presentation_engine.js | 68 ++++++++++++++++++++++---------
1 file changed, 49 insertions(+), 19 deletions(-)
New commits:
commit d95512d815f7ca9fd5d07f0986410894d849b384
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Sun Nov 22 18:51:11 2015 +0100
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/20243
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index f56621b..f6426dc 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -3776,16 +3776,27 @@ function PriorityQueue( aCompareFunc )
{
this.aSequence = new Array();
this.aCompareFunc = aCompareFunc;
- this.bSorted = true;
}
-PriorityQueue.prototype.top = function()
+PriorityQueue.prototype.clone = function()
{
- if( !this.bSorted )
+ var aCopy = new PriorityQueue( this.aCompareFunc );
+ var src = this.aSequence;
+ var dest = [];
+ var i, l;
+ for( i = 0, l = src.length; i < l; ++i )
{
- this.aSequence.sort(this.aCompareFunc)
- this.bSorted = true;
+ if( i in src )
+ {
+ dest.push( src[i] );
+ }
}
+ aCopy.aSequence = dest;
+ return aCopy;
+};
+
+PriorityQueue.prototype.top = function()
+{
return this.aSequence[this.aSequence.length - 1];
};
@@ -3796,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
**********************************************************************************************/
@@ -10334,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();
@@ -12888,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;
+ }
};
More information about the Libreoffice-commits
mailing list