Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-06-30 19:06:23 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-06-30 19:08:33 +0400
commite919a37e97874d2e7b5abc134eab7ed43c993b18 (patch)
tree1a9ba8d4490c6edd77a8d58e324425ec2da5796c /source/blender/imbuf/intern/png.c
parent2e64b8354bc68c22a0051cbb65937098b537cd65 (diff)
Fix T40818: libpng warning: iCCP: known incorrect sRGB profile
Suppress warning for now, it's harmless and only happens with new libpng. In the future we might try enabling it for non-datatoc-ed files, but it's really not worth spending lots of time on.
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r--source/blender/imbuf/intern/png.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index b620dbd9b10..23f5cc1fe81 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -35,8 +35,10 @@
#include "BLI_utildefines.h"
#include "BLI_fileops.h"
-
#include "BLI_math.h"
+
+#include "BKE_global.h"
+
#include "MEM_guardedalloc.h"
#include "imbuf.h"
@@ -484,6 +486,23 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
return(1);
}
+static void imb_png_warning(png_structp png_ptr, png_const_charp message)
+{
+ /* We supress iCCP warnings. That's how Blender always used to behave,
+ * and with new libpng it became too much picky, giving a warning on
+ * the splash screen even.
+ */
+ if ((G.debug & G_DEBUG) == 0 && !strncmp(message, "iCCP", 4)) {
+ return;
+ }
+ fprintf(stderr, "libpng warning: %s\n", message);
+}
+
+static void imb_png_error(png_structp png_ptr, png_const_charp message)
+{
+ fprintf(stderr, "libpng error: %s\n", message);
+}
+
ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
struct ImBuf *ibuf = NULL;
@@ -513,6 +532,8 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[I
return NULL;
}
+ png_set_error_fn(png_ptr, NULL, imb_png_error, imb_png_warning);
+
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) {
png_destroy_read_struct(&png_ptr, (png_infopp)NULL,