diff options
-rw-r--r-- | BUILD.gn | 4 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_pngmodule.cpp | 7 | ||||
-rw-r--r-- | pdfium.gni | 3 | ||||
-rw-r--r-- | testing/image_diff/image_diff_png.cpp | 7 | ||||
-rw-r--r-- | third_party/BUILD.gn | 15 |
5 files changed, 30 insertions, 6 deletions
@@ -273,7 +273,7 @@ static_library("image_diff") { configs += [ ":pdfium_core_config" ] deps = [] if (!pdf_enable_xfa) { - deps += [ "third_party:fx_lpng" ] + deps += [ "third_party:png" ] } } @@ -781,8 +781,8 @@ static_library("fxcodec") { "core/fxcodec/lbmp/fx_bmp.h", ] deps += [ - "third_party:fx_lpng", "third_party:fx_tiff", + "third_party:png", ] } if (is_posix) { diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp index 40bdfba7ce..37e83f7248 100644 --- a/core/fxcodec/codec/ccodec_pngmodule.cpp +++ b/core/fxcodec/codec/ccodec_pngmodule.cpp @@ -14,10 +14,11 @@ #include "core/fxge/fx_dib.h" #include "third_party/base/ptr_util.h" -extern "C" { -#undef FAR +#ifdef USE_SYSTEM_LIBPNG +#include <png.h> +#else #include "third_party/libpng16/png.h" -} // extern "C" +#endif #define PNG_ERROR_SIZE 256 diff --git a/pdfium.gni b/pdfium.gni index 530301a5d9..f05623af77 100644 --- a/pdfium.gni +++ b/pdfium.gni @@ -61,6 +61,9 @@ declare_args() { # Don't build against bundled lcms2. use_system_lcms2 = false + + # Don't build against bundled libpng. + use_system_libpng = false } if (pdf_use_skia && pdf_use_skia_paths) { diff --git a/testing/image_diff/image_diff_png.cpp b/testing/image_diff/image_diff_png.cpp index 56be539057..48b5ae17b4 100644 --- a/testing/image_diff/image_diff_png.cpp +++ b/testing/image_diff/image_diff_png.cpp @@ -17,9 +17,14 @@ #include <string> #include "third_party/base/logging.h" -#include "third_party/libpng16/png.h" #include "third_party/zlib/zlib.h" +#ifdef USE_SYSTEM_LIBPNG +#include <png.h> +#else +#include "third_party/libpng16/png.h" +#endif + namespace image_diff_png { namespace { diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn index a188f56194..3861f6aed7 100644 --- a/third_party/BUILD.gn +++ b/third_party/BUILD.gn @@ -398,6 +398,21 @@ static_library("fx_libopenjpeg") { ] } +config("system_libpng_config") { + libs = [ "png" ] + defines = [ "USE_SYSTEM_LIBPNG" ] +} + +group("png") { + if (use_system_libpng) { + public_configs = [ ":system_libpng_config" ] + } else { + public_deps = [ + ":fx_lpng", + ] + } +} + static_library("fx_lpng") { configs -= [ "//build/config/compiler:chromium_code" ] configs += [ |