Link SkShaper/SkParagraph into the engine by default (#23626)

This commit is contained in:
Jason Simmons 2021-01-12 15:49:01 -08:00 committed by GitHub
parent cf42dbe139
commit f1278d0e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View File

@ -14,9 +14,12 @@ declare_args() {
# The runtime mode ("debug", "profile", "release", or "jit_release")
flutter_runtime_mode = "debug"
# Whether to use the Skia text shaper module
# Whether to link the Skia text shaper module into the engine
flutter_enable_skshaper = false
# Whether to use the Skia text shaper module for all text rendering
flutter_always_use_skshaper = false
# Whether to use the legacy embedder when building for Fuchsia.
flutter_enable_legacy_fuchsia_embedder = true
}

View File

@ -135,6 +135,9 @@ source_set("ui") {
if (flutter_enable_skshaper) {
defines += [ "FLUTTER_ENABLE_SKSHAPER" ]
}
if (flutter_always_use_skshaper) {
defines += [ "FLUTTER_ALWAYS_USE_SKSHAPER" ]
}
if (is_win) {
# Required for M_PI and others.
defines += [ "_USE_MATH_DEFINES" ]

View File

@ -301,10 +301,15 @@ ParagraphBuilder::ParagraphBuilder(
ParagraphBuilderFactory factory = txt::ParagraphBuilder::CreateTxtBuilder;
#if FLUTTER_ENABLE_SKSHAPER
if (UIDartState::Current()->enable_skparagraph()) {
#if FLUTTER_ALWAYS_USE_SKSHAPER
bool enable_skparagraph = true;
#else
bool enable_skparagraph = UIDartState::Current()->enable_skparagraph();
#endif
if (enable_skparagraph) {
factory = txt::ParagraphBuilder::CreateSkiaBuilder;
}
#endif
#endif // FLUTTER_ENABLE_SKSHAPER
m_paragraphBuilder = factory(style, font_collection.GetFontCollection());
}

View File

@ -107,6 +107,7 @@ def to_gn_args(args):
gn_args['flutter_enable_skshaper'] = args.enable_skshaper
if args.enable_skshaper:
gn_args['skia_use_icu'] = True
gn_args['flutter_always_use_skshaper'] = args.always_use_skshaper
gn_args['is_official_build'] = True # Disable Skia test utilities.
gn_args['dart_component_kind'] = 'static_library' # Always link Dart in statically.
gn_args['is_debug'] = args.unoptimized
@ -388,9 +389,12 @@ def parse_args(args):
parser.add_argument('--enable-vulkan', action='store_true', default=False)
parser.add_argument('--enable-fontconfig', action='store_true', default=False)
parser.add_argument('--enable-skshaper', action='store_true', default=False)
parser.add_argument('--enable-vulkan-validation-layers', action='store_true', default=False)
parser.add_argument('--enable-skshaper', action='store_true', default=True)
parser.add_argument('--no-enable-skshaper', dest='enable_skshaper', action='store_false')
parser.add_argument('--always-use-skshaper', action='store_true', default=False)
parser.add_argument('--embedder-for-target', dest='embedder_for_target', action='store_true', default=False)
parser.add_argument('--coverage', default=False, action='store_true')