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

Unified Diff: src/images/SkImageDecoder_libjpeg.cpp

Issue 26863003: Simplify code for configuring suppression of ImageDecoder warnings (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebased again Created 7 years, 2 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 | src/images/SkImageDecoder_libpng.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libjpeg.cpp
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 3e34a277fd0494a46dfafc7fa8a2364f889c2915..64309514184330fa7e2e36aec6c355c38b430fb0 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -16,12 +16,10 @@
#include "SkTemplates.h"
#include "SkTime.h"
#include "SkUtils.h"
+#include "SkRTConf.h"
#include "SkRect.h"
#include "SkCanvas.h"
-#if defined(SK_DEBUG)
-#include "SkRTConf.h" // SK_CONF_DECLARE
-#endif // defined(SK_DEBUG)
#include <stdio.h>
extern "C" {
@@ -40,10 +38,14 @@ extern "C" {
// support for two additional formats (1) JCS_RGBA_8888 and (2) JCS_RGB_565.
#if defined(SK_DEBUG)
-SK_CONF_DECLARE(bool, c_suppressJPEGImageDecoderWarnings,
- "images.jpeg.suppressDecoderWarnings", false,
- "Suppress most JPG warnings when calling decode functions.");
+#define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS false
+#else // !defined(SK_DEBUG)
+#define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS true
#endif // defined(SK_DEBUG)
+SK_CONF_DECLARE(bool, c_suppressJPEGImageDecoderWarnings,
+ "images.jpeg.suppressDecoderWarnings",
+ DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS,
+ "Suppress most JPG warnings when calling decode functions.");
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -74,7 +76,6 @@ static void initialize_info(jpeg_decompress_struct* cinfo, skjpeg_source_mgr* sr
jpeg_create_decompress(cinfo);
overwrite_mem_buffer_size(cinfo);
cinfo->src = src_mgr;
-#if defined(SK_DEBUG)
/* To suppress warnings with a SK_DEBUG binary, set the
* environment variable "skia_images_jpeg_suppressDecoderWarnings"
* to "true". Inside a program that links to skia:
@@ -82,9 +83,6 @@ static void initialize_info(jpeg_decompress_struct* cinfo, skjpeg_source_mgr* sr
if (c_suppressJPEGImageDecoderWarnings) {
cinfo->err->emit_message = &do_nothing_emit_message;
}
-#else // Always suppress in release mode.
- cinfo->err->emit_message = &do_nothing_emit_message;
-#endif // defined(SK_DEBUG)
}
#ifdef SK_BUILD_FOR_ANDROID
« no previous file with comments | « no previous file | src/images/SkImageDecoder_libpng.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698