summaryrefslogtreecommitdiffhomepage
path: root/loader/error-tex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'loader/error-tex.cpp')
-rw-r--r--loader/error-tex.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/loader/error-tex.cpp b/loader/error-tex.cpp
index 4cc64f91..7f91f032 100644
--- a/loader/error-tex.cpp
+++ b/loader/error-tex.cpp
@@ -1,15 +1,20 @@
#include "impl.hpp"
+#include "compat/assert.hpp"
+#include <Corrade/Containers/Array.h>
#include <Magnum/Math/Vector4.h>
#include <Magnum/PixelFormat.h>
#include <Magnum/Trade/ImageData.h>
namespace floormat::loader_detail {
-Trade::ImageData2D loader_impl::make_error_texture()
+Trade::ImageData2D loader_impl::make_error_texture(Vector2ui size)
{
- static const Vector4ub data[] = { {255, 0, 255, 255} }; // magenta
- return Trade::ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, {},
- Containers::arrayView(data, 1), {}, {}};
+ fm_assert(size.product() != 0);
+ constexpr auto magenta = Vector4ub{255, 0, 255, 255};
+ auto array = Array<Vector4ub>{DirectInit, size.product(), magenta};
+ auto img = Trade::ImageData2D{PixelFormat::RGBA8Unorm, Vector2i(size), {},
+ std::move(array), {}, {}};
+ return img;
}
} // namespace floormat::loader_detail