From 694b069876aaa8ac2d8af67a6a71b88e4cdcda4d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Dec 2023 17:08:59 +0100 Subject: a --- loader/error-tex.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'loader/error-tex.cpp') 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 #include #include #include 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{DirectInit, size.product(), magenta}; + auto img = Trade::ImageData2D{PixelFormat::RGBA8Unorm, Vector2i(size), {}, + std::move(array), {}, {}}; + return img; } } // namespace floormat::loader_detail -- cgit v1.2.3