[canvaskit] Enable some options on npm build

This also makes the effects deserialization available via compile flag.

Change-Id: Ib6692499a619205ac480a8823ce7de12c0a5a723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303596
Reviewed-by: Nathaniel Nifong <nifong@google.com>
This commit is contained in:
Kevin Lubick 2020-07-20 10:32:40 -04:00
parent b7bcabb373
commit d9926908b5
3 changed files with 17 additions and 5 deletions

View File

@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Compile option to deserialize effects in skps `include_effects_deserialization`.
### Changed
- Pathops and SKP deserialization/serialization enabled on the npm build.
## [0.17.0] - 2020-07-20
### Added

View File

@ -67,12 +67,12 @@ npm:
mkdir -p ./canvaskit/bin
# These features are turned off to keep code size smaller for the
# general use case.
./compile.sh release no_skottie no_particles no_pathops no_rt_shader no_skp no_alias_font
./compile.sh release no_skottie no_particles no_rt_shader no_alias_font
cp ../../out/canvaskit_wasm/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.wasm ./canvaskit/bin
mkdir -p ./canvaskit/bin/core
./compile.sh release no_skottie no_particles no_pathops no_rt_shader no_font no_skp
./compile.sh release no_skottie no_particles no_pathops no_rt_shader no_font no_skp_serialization
cp ../../out/canvaskit_wasm/canvaskit.js ./canvaskit/bin/core
cp ../../out/canvaskit_wasm/canvaskit.wasm ./canvaskit/bin/core

View File

@ -76,10 +76,16 @@ if [[ $@ == *cpu* ]]; then
fi
SKP_JS="--pre-js $BASE_DIR/skp.js"
GN_SKP_FLAGS=""
GN_SKP_FLAGS="\"-DSK_DISABLE_EFFECT_DESERIALIZATION\","
WASM_SKP="-DSK_SERIALIZE_SKP"
if [[ $@ == *no_skp* ]]; then
if [[ $@ == *no_skp_serialization* ]]; then
# This saves about 20kb compressed.
SKP_JS=""
WASM_SKP=""
elif [[ $@ == *include_effects_deserialization* ]]; then
# This costs about 60kb compressed, so it is disabled by default.
echo "Enabling effects deserialization"
GN_SKP_FLAGS=""
fi
SKOTTIE_JS="--pre-js $BASE_DIR/skottie.js"
@ -135,6 +141,7 @@ fi
WASM_PATHOPS="-DSK_INCLUDE_PATHOPS"
PATHOPS_JS="--pre-js $BASE_DIR/pathops.js"
if [[ $@ == *no_pathops* ]] ; then
# This saves about 2kb compressed.
WASM_PATHOPS=""
PATHOPS_JS=""
fi
@ -260,7 +267,6 @@ echo "Compiling bitcode"
extra_cflags_cc=[\"-frtti\"] \
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\", \"-s\", \"MAIN_MODULE=1\",
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
\"-DSK_DISABLE_EFFECT_DESERIALIZATION\",
\"-DSK_FORCE_8_BYTE_ALIGNMENT\",
${GN_GPU_FLAGS}
${GN_SKP_FLAGS}