From b2f7b6be4c6695fa741f2eafaef3af5bce5c30c2 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 2 Dec 2016 19:11:34 +0100 Subject: Store filename with Image for use when reporting errors. --- plugingui/image.cc | 5 ++++- plugingui/image.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugingui/image.cc b/plugingui/image.cc index 666170d..ea295b9 100644 --- a/plugingui/image.cc +++ b/plugingui/image.cc @@ -45,6 +45,7 @@ Image::Image(const char* data, size_t size) } Image::Image(const std::string& filename) + : filename(filename) { Resource rc(filename); load(rc.data(), rc.size()); @@ -54,6 +55,7 @@ Image::Image(Image&& other) : _width(other._width) , _height(other._height) , image_data(std::move(other.image_data)) + , filename(other.filename) { other._width = 0; other._height = 0; @@ -118,7 +120,8 @@ void Image::load(const char* data, size_t size) if(res != 0) { - ERR(image, "Error in lodepng_decode32: %d", res); + ERR(image, "Error in lodepng_decode32: %d while loading '%s'", + res, filename.c_str()); setError(); return; } diff --git a/plugingui/image.h b/plugingui/image.h index ae0e051..e70215e 100644 --- a/plugingui/image.h +++ b/plugingui/image.h @@ -60,6 +60,7 @@ private: std::size_t _height{0}; std::vector image_data; Colour out_of_range{0.0f, 0.0f, 0.0f, 0.0f}; + std::string filename; }; } // GUI:: -- cgit v1.2.3