From 09fe55427ee8cddf3a855318ed2c24e269407e46 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 13 May 2024 16:32:39 -0700 Subject: [PATCH 1/3] [Impeller] make default glyph atlas size much bigger. --- .../backends/skia/typographer_context_skia.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/impeller/typographer/backends/skia/typographer_context_skia.cc b/impeller/typographer/backends/skia/typographer_context_skia.cc index 25f36c73bc05c..89871431ae9a9 100644 --- a/impeller/typographer/backends/skia/typographer_context_skia.cc +++ b/impeller/typographer/backends/skia/typographer_context_skia.cc @@ -194,16 +194,12 @@ static ISize OptimumAtlasSizeForFontGlyphPairs( const std::vector& pairs, std::vector& glyph_positions, const std::shared_ptr& atlas_context, - GlyphAtlas::Type type, const ISize& max_texture_size) { - static constexpr auto kMinAtlasSize = 8u; - static constexpr auto kMinAlphaBitmapSize = 1024u; + static constexpr ISize kMinAtlasSize = ISize{4096, 4096}; TRACE_EVENT0("impeller", __FUNCTION__); - ISize current_size = type == GlyphAtlas::Type::kAlphaBitmap - ? ISize(kMinAlphaBitmapSize, kMinAlphaBitmapSize) - : ISize(kMinAtlasSize, kMinAtlasSize); + ISize current_size = kMinAtlasSize; size_t total_pairs = pairs.size() + 1; do { auto rect_packer = std::shared_ptr( @@ -406,7 +402,6 @@ std::shared_ptr TypographerContextSkia::CreateGlyphAtlas( font_glyph_pairs, // glyph_positions, // atlas_context, // - type, // context.GetResourceAllocator()->GetMaxTextureSizeSupported() // ); From 501cf1f6d157bf02941e4850993fb72c85711d99 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 14 May 2024 13:17:19 -0700 Subject: [PATCH 2/3] Update typographer_context_skia.cc --- impeller/typographer/backends/skia/typographer_context_skia.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impeller/typographer/backends/skia/typographer_context_skia.cc b/impeller/typographer/backends/skia/typographer_context_skia.cc index 409133df2e51e..025fb8828c1a5 100644 --- a/impeller/typographer/backends/skia/typographer_context_skia.cc +++ b/impeller/typographer/backends/skia/typographer_context_skia.cc @@ -195,7 +195,7 @@ static ISize OptimumAtlasSizeForFontGlyphPairs( std::vector& glyph_positions, const std::shared_ptr& atlas_context, const ISize& max_texture_size) { - static constexpr ISize kMinAtlasSize = ISize{4096, 4096}; + static constexpr ISize kMinAtlasSize = ISize{4096, 1024}; TRACE_EVENT0("impeller", __FUNCTION__); From 4716c272a6578ad67add25ff86b94edf8a058dac Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 14 May 2024 17:33:16 -0700 Subject: [PATCH 3/3] update test expectations. --- impeller/typographer/typographer_unittests.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/impeller/typographer/typographer_unittests.cc b/impeller/typographer/typographer_unittests.cc index e28877d0b862b..1b5003982da00 100644 --- a/impeller/typographer/typographer_unittests.cc +++ b/impeller/typographer/typographer_unittests.cc @@ -151,8 +151,8 @@ TEST_P(TypographerTest, GlyphAtlasWithOddUniqueGlyphSize) { ASSERT_NE(atlas, nullptr); ASSERT_NE(atlas->GetTexture(), nullptr); - ASSERT_EQ(atlas->GetTexture()->GetSize().width, - atlas->GetTexture()->GetSize().height); + EXPECT_EQ(atlas->GetTexture()->GetSize().width, 4096u); + EXPECT_EQ(atlas->GetTexture()->GetSize().height, 1024u); } TEST_P(TypographerTest, GlyphAtlasIsRecycledIfUnchanged) {