Skip to content

Commit 03d900a

Browse files
committed
Only require segments to merge are inert (and not base) to skip closure.
If all of the things being added to base are inert then we know they don't interact with base so we can skip doing the closure analysis.
1 parent 2e2eb17 commit 03d900a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ift/encoder/candidate_merge.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,20 +612,21 @@ StatusOr<std::optional<CandidateMerge>> CandidateMerge::AssessSegmentMerge(
612612
}
613613

614614
uint32_t new_patch_size = 0;
615-
if (!segments_to_merge_and_base_are_inert) {
615+
if (!segments_to_merge_are_inert) {
616616
GlyphSet and_gids, or_gids, exclusive_gids;
617617
TRYV(merger.Context().AnalyzeSegment(segments_to_merge_with_base, and_gids,
618618
or_gids, exclusive_gids));
619619
new_patch_size =
620620
TRY(merger.Context().patch_size_cache->GetPatchSize(exclusive_gids));
621621
} else {
622-
// When the inputs to a merge are all inert then we can assume the merged
623-
// patch is just a combination of the glyphs from the input segments. This
624-
// saves a closure computation.
622+
// When the segments being added to base are all inert then we can assume
623+
// the merged patch is just a combination of the glyphs from the base and
624+
// the input segments. Since the segments being added are intert we know
625+
// that they won't interact with base and will just bring along their own
626+
// glyphs.
625627
GlyphSet merged_glyphs = gid_conditions_to_update;
626628
merged_glyphs.union_set(
627-
merger.Context().glyph_condition_set.GlyphsWithSegment(
628-
base_segment_index));
629+
merger.Context().glyph_groupings.ExclusiveGlyphs(base_segment_index));
629630
new_patch_size =
630631
TRY(merger.Context().patch_size_cache->GetPatchSize(merged_glyphs));
631632
}

0 commit comments

Comments
 (0)