diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-04 15:08:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-07 06:39:41 +0000 |
commit | c0c69ccd2aac45e4cca0de7d4deaa6d02ec27f4d (patch) | |
tree | 9b9d53c82e162162b3ee2d5b40b9f9323f75efa6 /include | |
parent | 496c0de160dd405c9f089679fc5f590bfe15e49e (diff) |
convert sdr::animation::EventList to o3tl::sorted_vector
instead of home-grown linked list
Change-Id: I7cf24692e7b9919ac83e404e2d0167c3015b97de
Reviewed-on: https://gerrit.libreoffice.org/30569
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/sdr/animation/scheduler.hxx | 49 |
1 files changed, 6 insertions, 43 deletions
diff --git a/include/svx/sdr/animation/scheduler.hxx b/include/svx/sdr/animation/scheduler.hxx index 1d1c16ac289d..15eaa344b9d6 100644 --- a/include/svx/sdr/animation/scheduler.hxx +++ b/include/svx/sdr/animation/scheduler.hxx @@ -23,31 +23,24 @@ #include <sal/types.h> #include <vcl/timer.hxx> #include <svx/svxdllapi.h> +#include <o3tl/sorted_vector.hxx> -// event class - namespace sdr { namespace animation { + class SVX_DLLPUBLIC Event { // time of event in ms sal_uInt32 mnTime; - // pointer for linked list sorted by mnTime - Event* mpNext; - public: // constructor/destructor SAL_DLLPRIVATE explicit Event(); virtual ~Event(); - // access to mpNext - SAL_DLLPRIVATE Event* GetNext() const { return mpNext; } - SAL_DLLPRIVATE void SetNext(Event* pNew); - // get/set time SAL_DLLPRIVATE sal_uInt32 GetTime() const { return mnTime; } void SetTime(sal_uInt32 nNew); @@ -55,43 +48,12 @@ namespace sdr // execute event virtual void Trigger(sal_uInt32 nTime) = 0; }; - } // end of namespace animation -} // end of namespace sdr - -// eventlist class - -namespace sdr -{ - namespace animation - { - class SVX_DLLPUBLIC EventList + struct CompareEvent { - // pointer to first entry - Event* mpHead; - - public: - // constructor/destructor - SAL_DLLPRIVATE EventList(); - virtual ~EventList(); - - // insert/remove time dependent - SAL_DLLPRIVATE void Insert(Event* pNew); - SAL_DLLPRIVATE void Remove(Event* pOld); - - // get first - SAL_DLLPRIVATE Event* GetFirst() { return mpHead; } + bool operator()(Event* const& lhs, Event* const& rhs) const; }; - } // end of namespace animation -} // end of namespace sdr - -// scheduler class - -namespace sdr -{ - namespace animation - { class SVX_DLLPUBLIC Scheduler : public Timer { // time in ms @@ -101,7 +63,7 @@ namespace sdr sal_uInt32 mnDeltaTime; // list of events - EventList maList; + o3tl::sorted_vector<Event*, CompareEvent> maList; // Flag which remembers if this timer is paused. Default // is false. @@ -135,6 +97,7 @@ namespace sdr SAL_DLLPRIVATE bool IsPaused() const { return mbIsPaused; } SAL_DLLPRIVATE void SetPaused(bool bNew); }; + } // end of namespace animation } // end of namespace sdr |