[canvaskit] Add legacy drawvertices mode to npm build

Should help with https://github.com/flutter/flutter/issues/98531
until Flutter removes c25fd021ed/gn/flutter_defines.gni (L17)

Change-Id: I151c17dbea969b787fb785b999f9d760ae3b25ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/511976
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
This commit is contained in:
Kevin Lubick 2022-02-23 09:49:19 -05:00
parent 64f3f988e4
commit e1c79a9189
4 changed files with 12 additions and 2 deletions

View File

@ -351,7 +351,10 @@ skia_wasm_lib("canvaskit") {
if (!skia_canvaskit_enable_alias_font) {
defines += [ "CANVASKIT_NO_ALIAS_FONT" ]
}
if (skia_canvaskit_legacy_draw_vertices_blend_mode) {
# https://github.com/flutter/flutter/issues/98531
defines += [ "SK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER" ]
}
if (!skia_canvaskit_enable_font) {
defines += [ "CK_NO_FONTS" ]
}

View File

@ -72,7 +72,7 @@ npm:
# These features are turned off to keep code size smaller for the
# general use case.
./compile.sh release no_skottie no_particles no_rt_shader no_sksl_trace no_alias_font \
no_effects_deserialization no_encode_jpeg no_encode_webp
no_effects_deserialization no_encode_jpeg no_encode_webp legacy_draw_vertices
cp ../../out/canvaskit_wasm/canvaskit.js ./npm_build/bin
cp ../../out/canvaskit_wasm/canvaskit.wasm ./npm_build/bin

View File

@ -19,6 +19,7 @@ declare_args() {
skia_canvaskit_include_viewer = false
skia_canvaskit_force_tracing = false
skia_canvaskit_profile_build = false
skia_canvaskit_legacy_draw_vertices_blend_mode = false
}
# Assert that skia_canvaskit_profile_build implies release mode.

View File

@ -138,6 +138,11 @@ if [[ $@ == *no_alias_font* ]]; then
ENABLE_ALIAS_FONT="false"
fi
LEGACY_DRAW_VERTICES="false"
if [[ $@ == *legacy_draw_vertices* ]]; then
LEGACY_DRAW_VERTICES="true"
fi
GN_SHAPER="skia_use_icu=true skia_use_system_icu=false skia_use_harfbuzz=true skia_use_system_harfbuzz=false"
if [[ $@ == *primitive_shaper* ]] || [[ $@ == *no_font* ]]; then
echo "Using the primitive shaper instead of the harfbuzz/icu one"
@ -242,6 +247,7 @@ echo "Compiling"
skia_canvaskit_enable_font=${ENABLE_FONT} \
skia_canvaskit_enable_embedded_font=${ENABLE_EMBEDDED_FONT} \
skia_canvaskit_enable_alias_font=${ENABLE_ALIAS_FONT} \
skia_canvaskit_legacy_draw_vertices_blend_mode=${LEGACY_DRAW_VERTICES} \
skia_canvaskit_enable_paragraph=${ENABLE_PARAGRAPH}"
${NINJA} -C ${BUILD_DIR} canvaskit.js