1// Aseprite
2// Copyright (C) 2020 Igara Studio S.A.
3// Copyright (C) 2001-2017 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifdef HAVE_CONFIG_H
9#include "config.h"
10#endif
11
12#include "app/ui/skin/skin_part.h"
13
14#include "os/surface.h"
15
16namespace app {
17namespace skin {
18
19SkinPart::SkinPart()
20{
21}
22
23SkinPart::~SkinPart()
24{
25 clear();
26}
27
28void SkinPart::clear()
29{
30 m_bitmaps.clear();
31}
32
33void SkinPart::setBitmap(std::size_t index, const os::SurfaceRef& bitmap)
34{
35 if (index >= m_bitmaps.size())
36 m_bitmaps.resize(index+1, nullptr);
37
38 m_bitmaps[index] = bitmap;
39}
40
41void SkinPart::setSpriteBounds(const gfx::Rect& bounds)
42{
43 m_spriteBounds = bounds;
44}
45
46void SkinPart::setSlicesBounds(const gfx::Rect& bounds)
47{
48 m_slicesBounds = bounds;
49}
50
51gfx::Size SkinPart::size() const
52{
53 if (!m_bitmaps.empty())
54 return gfx::Size(m_bitmaps[0]->width(),
55 m_bitmaps[0]->height());
56 else
57 return gfx::Size(0, 0);
58}
59
60} // namespace skin
61} // namespace app
62