Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,12 @@ static ISize OptimumAtlasSizeForFontGlyphPairs(
const std::vector<FontGlyphPair>& pairs,
std::vector<Rect>& glyph_positions,
const std::shared_ptr<GlyphAtlasContext>& atlas_context,
GlyphAtlas::Type type,
const ISize& max_texture_size) {
static constexpr auto kMinAtlasSize = 8u;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, thats comically small. I think this was from a time when the glyph atlas was per render pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not even a single emoji!

static constexpr auto kMinAlphaBitmapSize = 1024u;
static constexpr ISize kMinAtlasSize = ISize{4096, 1024};

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<RectanglePacker>(
Expand Down Expand Up @@ -443,7 +439,6 @@ std::shared_ptr<GlyphAtlas> TypographerContextSkia::CreateGlyphAtlas(
font_glyph_pairs, //
glyph_positions, //
atlas_context, //
type, //
context.GetResourceAllocator()->GetMaxTextureSizeSupported() //
);

Expand Down
4 changes: 2 additions & 2 deletions impeller/typographer/typographer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down