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

View File

@ -10,9 +10,6 @@
using namespace Blah; using namespace Blah;
Aseprite::Aseprite()
= default;
Aseprite::Aseprite(const FilePath& path) Aseprite::Aseprite(const FilePath& path)
{ {
FileStream fs(path, FileMode::OpenRead); FileStream fs(path, FileMode::OpenRead);
@ -24,59 +21,6 @@ Aseprite::Aseprite(Stream& stream)
parse(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) void Aseprite::parse(Stream& stream)
{ {
if (!stream.is_readable()) if (!stream.is_readable())