| 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 | |
| 16 | namespace app { |
| 17 | namespace skin { |
| 18 | |
| 19 | SkinPart::SkinPart() |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | SkinPart::~SkinPart() |
| 24 | { |
| 25 | clear(); |
| 26 | } |
| 27 | |
| 28 | void SkinPart::clear() |
| 29 | { |
| 30 | m_bitmaps.clear(); |
| 31 | } |
| 32 | |
| 33 | void 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 | |
| 41 | void SkinPart::setSpriteBounds(const gfx::Rect& bounds) |
| 42 | { |
| 43 | m_spriteBounds = bounds; |
| 44 | } |
| 45 | |
| 46 | void SkinPart::setSlicesBounds(const gfx::Rect& bounds) |
| 47 | { |
| 48 | m_slicesBounds = bounds; |
| 49 | } |
| 50 | |
| 51 | gfx::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 |