forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcel_data.cpp
55 lines (45 loc) · 1.09 KB
/
cel_data.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
// Aseprite Document Library
// Copyright (c) 2001-2016 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/cel_data.h"
#include "gfx/rect.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/sprite.h"
namespace doc {
CelData::CelData(const ImageRef& image)
: WithUserData(ObjectType::CelData)
, m_image(image)
, m_opacity(255)
, m_bounds(0, 0,
image ? image->width(): 0,
image ? image->height(): 0)
, m_boundsF(nullptr)
{
}
CelData::CelData(const CelData& celData)
: WithUserData(ObjectType::CelData)
, m_image(celData.m_image)
, m_opacity(celData.m_opacity)
, m_bounds(celData.m_bounds)
, m_boundsF(celData.m_boundsF ? new gfx::RectF(*celData.m_boundsF):
nullptr)
{
}
CelData::~CelData()
{
delete m_boundsF;
}
void CelData::setImage(const ImageRef& image)
{
ASSERT(image.get());
m_image = image;
m_bounds.w = image->width();
m_bounds.h = image->height();
}
} // namespace doc