forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclear_cel.cpp
57 lines (46 loc) · 957 Bytes
/
clear_cel.cpp
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
57
// Aseprite
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/cmd/clear_cel.h"
#include "app/cmd/clear_image.h"
#include "app/cmd/remove_cel.h"
#include "app/doc.h"
#include "doc/cel.h"
#include "doc/layer.h"
namespace app {
namespace cmd {
using namespace doc;
ClearCel::ClearCel(Cel* cel)
: WithCel(cel)
{
Doc* doc = static_cast<Doc*>(cel->document());
if (cel->layer()->isBackground()) {
Image* image = cel->image();
ASSERT(image);
if (image)
m_seq.add(new cmd::ClearImage(image,
doc->bgColor(cel->layer())));
}
else {
m_seq.add(new cmd::RemoveCel(cel));
}
}
void ClearCel::onExecute()
{
m_seq.execute(context());
}
void ClearCel::onUndo()
{
m_seq.undo();
}
void ClearCel::onRedo()
{
m_seq.redo();
}
} // namespace cmd
} // namespace app