Skip to content

Commit b9138ca

Browse files
author
Jonah Williams
committed
[Impeller] revert glyph atlas texture recycling. (flutter#51428)
This is a speculative fix for flutter/flutter#144331 . I don't have a repro, but I think this may be due to flutter/flutter#144498 , wherein setting the contents of a texture is unsynchronized.
1 parent e76c956 commit b9138ca

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

impeller/typographer/backends/skia/typographer_context_skia.cc

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -446,20 +446,6 @@ std::shared_ptr<GlyphAtlas> TypographerContextSkia::CreateGlyphAtlas(
446446
}
447447
atlas_context_skia.UpdateBitmap(bitmap);
448448

449-
// If the new atlas size is the same size as the previous texture, reuse the
450-
// texture and treat this as an updated that replaces all glyphs.
451-
if (last_atlas && last_atlas->GetTexture()) {
452-
std::shared_ptr<Texture> last_texture = last_atlas->GetTexture();
453-
if (atlas_size == last_texture->GetSize()) {
454-
if (!UpdateGlyphTextureAtlas(bitmap, last_texture)) {
455-
return nullptr;
456-
}
457-
458-
glyph_atlas->SetTexture(last_texture);
459-
return glyph_atlas;
460-
}
461-
}
462-
463449
// ---------------------------------------------------------------------------
464450
// Step 7b: Upload the atlas as a texture.
465451
// ---------------------------------------------------------------------------

impeller/typographer/typographer_unittests.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ TEST_P(TypographerTest, RectanglePackerAddsNonoverlapingRectangles) {
338338
ASSERT_EQ(packer->percentFull(), 0);
339339
}
340340

341-
TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledWhenContentsAreRecreated) {
341+
TEST_P(TypographerTest,
342+
GlyphAtlasTextureIsRecycledWhenContentsAreNotRecreated) {
342343
auto context = TypographerContextSkia::Make();
343344
auto atlas_context = context->CreateGlyphAtlasContext();
344345
ASSERT_TRUE(context && context->IsValid());
@@ -370,7 +371,7 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledWhenContentsAreRecreated) {
370371

371372
auto new_packer = atlas_context->GetRectPacker();
372373

373-
ASSERT_EQ(second_texture, first_texture);
374+
ASSERT_NE(second_texture, first_texture);
374375
ASSERT_NE(old_packer, new_packer);
375376
}
376377

0 commit comments

Comments
 (0)