Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: src/codec/SkCodec_libpng.cpp

Issue 1009633005: Silence PNG warnings from SkPngCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec_libpng.cpp
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 8f2bdd35a00da5760e8284e3c4bf36d89e304e07..4850235c0794ab591e8e16167d0409be214a313c 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -50,6 +50,10 @@ static void sk_error_fn(png_structp png_ptr, png_const_charp msg) {
longjmp(png_jmpbuf(png_ptr), 1);
}
+void sk_warning_fn(png_structp, png_const_charp msg) {
+ SkCodecPrintf("----- png warning %s\n", msg);
+}
+
static void sk_read_fn(png_structp png_ptr, png_bytep data,
png_size_t length) {
SkStream* stream = static_cast<SkStream*>(png_get_io_ptr(png_ptr));
@@ -199,9 +203,8 @@ bool SkPngCodec::IsPng(SkStream* stream) {
SkCodec* SkPngCodec::NewFromStream(SkStream* stream) {
// The image is known to be a PNG. Decode enough to know the SkImageInfo.
- // FIXME: Allow silencing warnings.
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
- sk_error_fn, NULL);
+ sk_error_fn, sk_warning_fn);
if (!png_ptr) {
return NULL;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698