[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - filter/source
Marco Cecchetti
marco.cecchetti at collabora.com
Sat Nov 28 15:31:14 PST 2015
filter/source/svg/presentation_engine.js | 55 ++++++++++++++++++-------------
1 file changed, 33 insertions(+), 22 deletions(-)
New commits:
commit f0e1936d4424ee6cfba9c99d6befd7583dd8d07e
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/20236
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 1ed6d1423c7cffa5403dad69a9946ec790a374f2)
Reviewed-on: https://gerrit.libreoffice.org/20262
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;
+ }
};
More information about the Libreoffice-commits
mailing list