Skip to content

Commit

Permalink
Link SkShaper/SkParagraph into the engine by default (flutter#23626)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored and hjfreyer committed Mar 22, 2021
1 parent 8705a0f commit 5f3e3a1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
5 changes: 4 additions & 1 deletion common/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions lib/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
9 changes: 7 additions & 2 deletions lib/ui/text/paragraph_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
6 changes: 5 additions & 1 deletion tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 5f3e3a1

Please sign in to comment.