From e1c79a91898ec290ba7fe0d222c922ba03c3f39c Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Wed, 23 Feb 2022 09:49:19 -0500 Subject: [PATCH] [canvaskit] Add legacy drawvertices mode to npm build Should help with https://github.com/flutter/flutter/issues/98531 until Flutter removes https://github.com/google/skia/blob/c25fd021edd04dabe4acad54a6288d6645dc2af8/gn/flutter_defines.gni#L17 Change-Id: I151c17dbea969b787fb785b999f9d760ae3b25ea Reviewed-on: https://skia-review.googlesource.com/c/skia/+/511976 Reviewed-by: Michael Ludwig Reviewed-by: Yegor Jbanov --- modules/canvaskit/BUILD.gn | 5 ++++- modules/canvaskit/Makefile | 2 +- modules/canvaskit/canvaskit.gni | 1 + modules/canvaskit/compile.sh | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/canvaskit/BUILD.gn b/modules/canvaskit/BUILD.gn index 3b3161149a..b0b685a854 100644 --- a/modules/canvaskit/BUILD.gn +++ b/modules/canvaskit/BUILD.gn @@ -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" ] } diff --git a/modules/canvaskit/Makefile b/modules/canvaskit/Makefile index 05aa85fd23..4a940347f8 100644 --- a/modules/canvaskit/Makefile +++ b/modules/canvaskit/Makefile @@ -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 diff --git a/modules/canvaskit/canvaskit.gni b/modules/canvaskit/canvaskit.gni index 7b5a844421..0d6a7474b0 100644 --- a/modules/canvaskit/canvaskit.gni +++ b/modules/canvaskit/canvaskit.gni @@ -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. diff --git a/modules/canvaskit/compile.sh b/modules/canvaskit/compile.sh index c83bf7932a..c875024fc2 100755 --- a/modules/canvaskit/compile.sh +++ b/modules/canvaskit/compile.sh @@ -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