clarified Aseprite state, removed unnecessary copy/move code

This commit is contained in:
Noel Berry 2022-02-12 00:16:11 -08:00
parent d559f1c8ee
commit 4c04fdd72f
2 changed files with 4 additions and 65 deletions

View File

@ -8,8 +8,9 @@
namespace Blah
{
// A simple Aseprite file parser.
// This implementation does not support Aseprite blendmodes,
// aside from the default blend mode.
// Note:
// - This implementation does not support Aseprite blendmodes.
// - This implementation does not yet support Tilesets.
class Aseprite
{
public:
@ -121,21 +122,15 @@ namespace Blah
Modes mode = Modes::RGBA;
int width = 0;
int height = 0;
Vector<Layer> layers;
Vector<Frame> frames;
Vector<Tag> tags;
Vector<Slice> slices;
Vector<Color> palette;
Aseprite();
Aseprite() = default;
Aseprite(const FilePath& path);
Aseprite(Stream& stream);
Aseprite(const Aseprite& src);
Aseprite(Aseprite&& src) noexcept;
Aseprite& operator=(const Aseprite& src);
Aseprite& operator=(Aseprite&& src) noexcept;
~Aseprite();
private:
UserData* m_last_userdata = nullptr;

View File

@ -10,9 +10,6 @@
using namespace Blah;
Aseprite::Aseprite()
= default;
Aseprite::Aseprite(const FilePath& path)
{
FileStream fs(path, FileMode::OpenRead);
@ -24,59 +21,6 @@ Aseprite::Aseprite(Stream& stream)
parse(stream);
}
Aseprite::Aseprite(const Aseprite& src)
{
mode = src.mode;
width = src.width;
height = src.height;
layers = src.layers;
frames = src.frames;
tags = src.tags;
slices = src.slices;
palette = src.palette;
}
Aseprite::Aseprite(Aseprite&& src) noexcept
{
mode = src.mode;
width = src.width;
height = src.height;
layers = std::move(src.layers);
frames = std::move(src.frames);
tags = std::move(src.tags);
slices = std::move(src.slices);
palette = std::move(src.palette);
}
Aseprite& Aseprite::operator=(const Aseprite& src)
{
mode = src.mode;
width = src.width;
height = src.height;
layers = src.layers;
frames = src.frames;
tags = src.tags;
slices = src.slices;
palette = src.palette;
return *this;
}
Aseprite& Aseprite::operator=(Aseprite&& src) noexcept
{
mode = src.mode;
width = src.width;
height = src.height;
layers = std::move(src.layers);
frames = std::move(src.frames);
tags = std::move(src.tags);
slices = std::move(src.slices);
palette = std::move(src.palette);
return *this;
}
Aseprite::~Aseprite()
= default;
void Aseprite::parse(Stream& stream)
{
if (!stream.is_readable())