summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/anim-atlas.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp
index 0c4d4f63..10d33bac 100644
--- a/src/anim-atlas.cpp
+++ b/src/anim-atlas.cpp
@@ -33,12 +33,22 @@ decltype(anim_atlas::_group_indices) anim_atlas::make_group_indices(const anim_d
anim_atlas::anim_atlas() noexcept = default;
anim_atlas::anim_atlas(StringView name, const ImageView2D& image, anim_def info) noexcept :
- _name{name}, _bitmask{ make_bitmask(image)},
+ _name{name}, _bitmask{make_bitmask(image)},
_info{std::move(info)}, _group_indices{make_group_indices(_info)}
{
const Size<3>& size = image.pixels().size();
fm_assert(size[0]*size[1] == _info.pixel_size.product());
fm_assert(size[2] >= 3 && size[2] <= 4);
+
+ for (const auto pixel_size = _info.pixel_size;
+ const auto& group : _info.groups)
+ for (const auto& fr : group.frames)
+ {
+ fm_assert(fr.size.product() != 0);
+ fm_assert(fr.offset < pixel_size);
+ fm_assert(fr.offset + fr.size <= pixel_size);
+ }
+
_tex.setWrapping(GL::SamplerWrapping::ClampToEdge)
.setMagnificationFilter(GL::SamplerFilter::Nearest)
.setMinificationFilter(GL::SamplerFilter::Nearest)