Replace third_party/gif: Preflight changes

Something is breaking client code in unexpected ways.  Let's try this
piecemeal.

  - skia_libgifcodec_path gn var. Default is
    third_party/externals/libgifcodec.  Anfroid framework uses
    third_party/libgifcodec.

  - skia_use_libgifcodec gn var; defaults to !skia_use_wuffs.  Allow
    disabling both codecs.

  - GN template("optional"): add public_include_dirs, similar to
    public_defines.

  - SK_USE_LIBGIFCODEC, ifdef for skia_use_libgifcodec.

  - SkCodec.cpp: use SK_USE_LIBGIFCODEC

Original CL:  https://review.skia.org/254582

Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian9-Clang-x86-devrel-Android_SKQP
Bug: skia:9654
Change-Id: I70561f5f945656065e4b318d5fff505961fb0b6b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255578
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2019-11-20 16:01:31 -05:00 committed by Skia Commit-Bot
parent 056358a123
commit 2dad99092c
5 changed files with 15 additions and 4 deletions

View File

@ -211,6 +211,9 @@ template("optional") {
if (defined(invoker.public_configs)) {
configs = invoker.public_configs
}
if (defined(invoker.public_include_dirs)) {
include_dirs = invoker.public_include_dirs
}
}
source_set(target_name) {
check_includes = false
@ -608,7 +611,8 @@ optional("gpu") {
}
optional("gif") {
enabled = !skia_use_wuffs
enabled = !skia_use_wuffs && skia_use_libgifcodec
public_defines = [ "SK_USE_LIBGIFCODEC" ]
sources = [
"src/codec/SkGifCodec.cpp",
"third_party/gif/SkGifImageReader.cpp",

View File

@ -318,6 +318,7 @@ def generate_args(target_os, enable_gpu):
'skia_use_fontconfig': 'false',
'skia_use_fixed_gamma_text': 'true',
'skia_include_multiframe_procs': 'false',
'skia_libgifcodec_path': '"third_party/libgifcodec"',
}
d['target_os'] = target_os
if target_os == '"android"':

View File

@ -29,6 +29,7 @@ declare_args() {
skia_generate_workarounds = false
skia_include_multiframe_procs = false
skia_lex = false
skia_libgifcodec_path = "third_party/externals/libgifcodec"
skia_pdf_subset_harfbuzz = false # TODO: set skia_pdf_subset_harfbuzz to skia_use_harfbuzz.
skia_qt_path = getenv("QT_PATH")
skia_skqp_global_error_tolerance = 0
@ -93,6 +94,7 @@ declare_args() {
skia_enable_nvpr = !skia_enable_flutter_defines
skia_enable_spirv_validation = is_skia_dev_build && is_debug && !skia_use_dawn
skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
skia_use_libgifcodec = !skia_use_wuffs
skia_use_sfntly = skia_use_icu
}

View File

@ -26,7 +26,7 @@
#include "src/codec/SkWebpCodec.h"
#ifdef SK_HAS_WUFFS_LIBRARY
#include "src/codec/SkWuffsCodec.h"
#else
#elif defined(SK_USE_LIBGIFCODEC)
#include "src/codec/SkGifCodec.h"
#endif
@ -45,7 +45,7 @@ static std::vector<DecoderProc>* decoders() {
#endif
#ifdef SK_HAS_WUFFS_LIBRARY
{ SkWuffsCodec_IsFormat, SkWuffsCodec_MakeFromStream },
#else
#elif defined(SK_USE_LIBGIFCODEC)
{ SkGifCodec::IsGif, SkGifCodec::MakeFromStream },
#endif
#ifdef SK_HAS_PNG_LIBRARY

View File

@ -150,7 +150,11 @@ def create_apk_impl(opts):
gn_args = opts.gn_args(arch)
args = ' '.join('%s=%s' % (k, v) for k, v in gn_args.items())
check_call(['bin/gn', 'gen', build, '--args=' + args])
check_call(['ninja', '-C', build, lib])
try:
check_call(['ninja', '-C', build, lib])
except subprocess.CalledProcessError:
check_call(['ninja', '-C', build, '-t', 'clean'])
check_call(['ninja', '-C', build, lib])
dst = '%s/%s' % (lib_dir, skia_to_android_arch_name_map[arch])
makedirs(dst)
shutil.copy(os.path.join(build, lib), dst)