forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayers_range.cpp
More file actions
56 lines (45 loc) · 1.01 KB
/
layers_range.cpp
File metadata and controls
56 lines (45 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Aseprite Document Library
// Copyright (c) 2001-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "doc/layers_range.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/sprite.h"
namespace doc {
LayersRange::LayersRange(const Sprite* sprite,
LayerIndex first, LayerIndex last)
: m_begin(sprite, first, last)
, m_end()
{
}
LayersRange::iterator::iterator()
: m_layer(nullptr)
, m_cur(-1)
, m_last(-1)
{
}
LayersRange::iterator::iterator(const Sprite* sprite,
LayerIndex first, LayerIndex last)
: m_layer(nullptr)
, m_cur(first)
, m_last(last)
{
m_layer = sprite->layer(first);
}
LayersRange::iterator& LayersRange::iterator::operator++()
{
if (!m_layer)
return *this;
++m_cur;
if (m_cur > m_last)
m_layer = nullptr;
else
m_layer = m_layer->getNext();
return *this;
}
} // namespace doc