summaryrefslogtreecommitdiffhomepage
path: root/anim-crop-tool
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-06 13:42:05 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-06 13:42:05 +0100
commit5f032f0e71f8382034c729577450e48721cfdc93 (patch)
tree67b5f5cae623fa33b15fa07e7907754b5763ac18 /anim-crop-tool
parent78f37b04e284ad7d46c17fb31df0ee064a818ae1 (diff)
switch anim atlas ground to unsigned
Diffstat (limited to 'anim-crop-tool')
-rw-r--r--anim-crop-tool/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/anim-crop-tool/main.cpp b/anim-crop-tool/main.cpp
index c6472186..48a1e0c7 100644
--- a/anim-crop-tool/main.cpp
+++ b/anim-crop-tool/main.cpp
@@ -121,9 +121,15 @@ static bool load_file(anim_group& group, options& opts, anim_atlas& atlas, const
(int)std::round(((int)group.ground[1] - start[1]) * opts.scale),
};
- const Magnum::Vector2ui dest_size_ = { (unsigned)dest_size.width, (unsigned)dest_size.height };
+ if (ground[0] < 0 || ground[1] < 0 || ground[0] >= dest_size.width || ground[1] >= dest_size.height)
+ {
+ Error{} << "ground marker for group" << group.name << "beyond image bounds";
+ return false;
+ }
+
+ const Vector2ui dest_size_ = { (unsigned)dest_size.width, (unsigned)dest_size.height };
- group.frames.push_back({ground, atlas.offset(), dest_size_});
+ group.frames.push_back({Vector2ui(ground), atlas.offset(), dest_size_});
atlas.add_entry({&group.frames.back(), std::move(resized)});
return true;
}