Skip to content

Commit 510a686

Browse files
committed
Change CelList and LayerList from std::list to std::vector
This change gives us an huge performance improvement to paint the Timeline widget.
1 parent 11c70ab commit 510a686

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Diff for: src/doc/cel_list.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Aseprite Document Library
2-
// Copyright (c) 2001-2014 David Capello
2+
// Copyright (c) 2001-2015 David Capello
33
//
44
// This file is released under the terms of the MIT license.
55
// Read LICENSE.txt for more information.
@@ -8,15 +8,15 @@
88
#define DOC_CEL_LIST_H_INCLUDED
99
#pragma once
1010

11-
#include <list>
11+
#include <vector>
1212

1313
namespace doc {
1414

1515
class Cel;
1616

17-
typedef std::list<Cel*> CelList;
18-
typedef std::list<Cel*>::iterator CelIterator;
19-
typedef std::list<Cel*>::const_iterator CelConstIterator;
17+
typedef std::vector<Cel*> CelList;
18+
typedef CelList::iterator CelIterator;
19+
typedef CelList::const_iterator CelConstIterator;
2020

2121
} // namespace doc
2222

Diff for: src/doc/layer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void LayerFolder::stackLayer(Layer* layer, Layer* after)
316316
m_layers.insert(after_it, layer);
317317
}
318318
else
319-
m_layers.push_front(layer);
319+
m_layers.insert(m_layers.begin(), layer);
320320
}
321321

322322
void LayerFolder::displaceFrames(frame_t fromThis, frame_t delta)

Diff for: src/doc/layer_list.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Aseprite Document Library
2-
// Copyright (c) 2001-2014 David Capello
2+
// Copyright (c) 2001-2015 David Capello
33
//
44
// This file is released under the terms of the MIT license.
55
// Read LICENSE.txt for more information.
@@ -8,15 +8,15 @@
88
#define DOC_LAYER_LIST_H_INCLUDED
99
#pragma once
1010

11-
#include <list>
11+
#include <vector>
1212

1313
namespace doc {
1414

1515
class Layer;
1616

17-
typedef std::list<Layer*> LayerList;
18-
typedef std::list<Layer*>::iterator LayerIterator;
19-
typedef std::list<Layer*>::const_iterator LayerConstIterator;
17+
typedef std::vector<Layer*> LayerList;
18+
typedef LayerList::iterator LayerIterator;
19+
typedef LayerList::const_iterator LayerConstIterator;
2020

2121
} // namespace doc
2222

0 commit comments

Comments
 (0)