Custom error functions for PNG
This commit is contained in:
@@ -33,6 +33,10 @@ class PNG : public Image
|
|||||||
public:
|
public:
|
||||||
PNG(std::string path);
|
PNG(std::string path);
|
||||||
~PNG();
|
~PNG();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void pngErrorFunction();
|
||||||
|
static void pngWarningFunction();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-1
@@ -37,7 +37,7 @@ dd::PNG::PNG(std::string path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize libpng
|
// Initialize libpng
|
||||||
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, (png_error_ptr)&PNG::pngErrorFunction, (png_error_ptr)&PNG::pngErrorFunction);
|
||||||
if (!png_ptr) {
|
if (!png_ptr) {
|
||||||
LOG_ERROR("libpng: Failed to initialze png_struct");
|
LOG_ERROR("libpng: Failed to initialze png_struct");
|
||||||
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
|
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
|
||||||
@@ -111,3 +111,13 @@ dd::PNG::~PNG()
|
|||||||
delete[] Data;
|
delete[] Data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dd::PNG::lpngErrorFunction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void dd::PNG::lpngWarningFunction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user