diff --git a/impeller/aiks/aiks_context.cc b/impeller/aiks/aiks_context.cc index e724ac597af9a..fc0a3efc45557 100644 --- a/impeller/aiks/aiks_context.cc +++ b/impeller/aiks/aiks_context.cc @@ -5,16 +5,19 @@ #include "impeller/aiks/aiks_context.h" #include "impeller/aiks/picture.h" +#include "impeller/typographer/text_render_context.h" namespace impeller { -AiksContext::AiksContext(std::shared_ptr context) +AiksContext::AiksContext(std::shared_ptr context, + std::shared_ptr text_render_context) : context_(std::move(context)) { if (!context_ || !context_->IsValid()) { return; } - content_context_ = std::make_unique(context_); + content_context_ = std::make_unique( + context_, std::move(text_render_context)); if (!content_context_->IsValid()) { return; } diff --git a/impeller/aiks/aiks_context.h b/impeller/aiks/aiks_context.h index fe62ebca47b45..9564a8a19cbab 100644 --- a/impeller/aiks/aiks_context.h +++ b/impeller/aiks/aiks_context.h @@ -10,6 +10,7 @@ #include "impeller/entity/contents/content_context.h" #include "impeller/renderer/context.h" #include "impeller/renderer/render_target.h" +#include "impeller/typographer/text_render_context.h" namespace impeller { @@ -18,7 +19,17 @@ class RenderPass; class AiksContext { public: - AiksContext(std::shared_ptr context); + /// Construct a new AiksContext. + /// + /// @param context The Impeller context that Aiks should use for + /// allocating resources and executing device + /// commands. Required. + /// @param text_render_context The text backend to use for rendering text. If + /// `nullptr` is supplied, then attempting to draw + /// text with Aiks will result in validation + /// errors. + AiksContext(std::shared_ptr context, + std::shared_ptr text_render_context); ~AiksContext(); diff --git a/impeller/aiks/aiks_playground.cc b/impeller/aiks/aiks_playground.cc index 5fc3124f283f8..cb39ce7647182 100644 --- a/impeller/aiks/aiks_playground.cc +++ b/impeller/aiks/aiks_playground.cc @@ -4,16 +4,25 @@ #include "impeller/aiks/aiks_playground.h" -#include "impeller/aiks/aiks_context.h" +#include +#include "impeller/aiks/aiks_context.h" +#include "impeller/typographer/backends/skia/text_render_context_skia.h" +#include "impeller/typographer/text_render_context.h" #include "third_party/imgui/imgui.h" namespace impeller { -AiksPlayground::AiksPlayground() = default; +AiksPlayground::AiksPlayground() + : text_render_context_(TextRenderContextSkia::Make()) {} AiksPlayground::~AiksPlayground() = default; +void AiksPlayground::SetTextRenderContext( + std::shared_ptr text_render_context) { + text_render_context_ = std::move(text_render_context); +} + bool AiksPlayground::OpenPlaygroundHere(const Picture& picture) { return OpenPlaygroundHere( [&picture](AiksContext& renderer, RenderTarget& render_target) -> bool { @@ -26,7 +35,7 @@ bool AiksPlayground::OpenPlaygroundHere(AiksPlaygroundCallback callback) { return true; } - AiksContext renderer(GetContext()); + AiksContext renderer(GetContext(), text_render_context_); if (!renderer.IsValid()) { return false; diff --git a/impeller/aiks/aiks_playground.h b/impeller/aiks/aiks_playground.h index 02647faa7e3b1..f391ea4d87776 100644 --- a/impeller/aiks/aiks_playground.h +++ b/impeller/aiks/aiks_playground.h @@ -8,6 +8,7 @@ #include "impeller/aiks/aiks_context.h" #include "impeller/aiks/picture.h" #include "impeller/playground/playground_test.h" +#include "impeller/typographer/text_render_context.h" namespace impeller { @@ -20,11 +21,16 @@ class AiksPlayground : public PlaygroundTest { ~AiksPlayground(); + void SetTextRenderContext( + std::shared_ptr text_render_context); + bool OpenPlaygroundHere(const Picture& picture); bool OpenPlaygroundHere(AiksPlaygroundCallback callback); private: + std::shared_ptr text_render_context_; + FML_DISALLOW_COPY_AND_ASSIGN(AiksPlayground); }; diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index d1dcadac7f105..557e122b62f24 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -1002,7 +1002,7 @@ TEST_P(AiksTest, CanPictureConvertToImage) { recorder_canvas.DrawRect({200.0, 200.0, 600, 600}, paint); Canvas canvas; - AiksContext renderer(GetContext()); + AiksContext renderer(GetContext(), nullptr); paint.color = Color::BlackTransparent(); canvas.DrawPaint(paint); Picture picture = recorder_canvas.EndRecordingAsPicture(); @@ -2139,7 +2139,7 @@ TEST_P(AiksTest, DrawPaintAbsorbsClears) { std::shared_ptr spy = ContextSpy::Make(); std::shared_ptr real_context = GetContext(); std::shared_ptr mock_context = spy->MakeContext(real_context); - AiksContext renderer(mock_context); + AiksContext renderer(mock_context, nullptr); std::shared_ptr image = picture.ToImage(renderer, {300, 300}); ASSERT_EQ(spy->render_passes_.size(), 1llu); @@ -2159,7 +2159,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClears) { Picture picture = canvas.EndRecordingAsPicture(); std::shared_ptr real_context = GetContext(); std::shared_ptr mock_context = spy->MakeContext(real_context); - AiksContext renderer(mock_context); + AiksContext renderer(mock_context, nullptr); std::shared_ptr image = picture.ToImage(renderer, {300, 300}); ASSERT_EQ(spy->render_passes_.size(), 1llu); @@ -2179,7 +2179,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRRect) { Picture picture = canvas.EndRecordingAsPicture(); std::shared_ptr real_context = GetContext(); std::shared_ptr mock_context = spy->MakeContext(real_context); - AiksContext renderer(mock_context); + AiksContext renderer(mock_context, nullptr); std::shared_ptr image = picture.ToImage(renderer, {300, 300}); ASSERT_EQ(spy->render_passes_.size(), 1llu); @@ -2199,7 +2199,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRotation) { Picture picture = canvas.EndRecordingAsPicture(); std::shared_ptr real_context = GetContext(); std::shared_ptr mock_context = spy->MakeContext(real_context); - AiksContext renderer(mock_context); + AiksContext renderer(mock_context, nullptr); std::shared_ptr image = picture.ToImage(renderer, {300, 300}); ASSERT_EQ(spy->render_passes_.size(), 1llu); @@ -2219,7 +2219,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClearsNegative) { Picture picture = canvas.EndRecordingAsPicture(); std::shared_ptr real_context = GetContext(); std::shared_ptr mock_context = spy->MakeContext(real_context); - AiksContext renderer(mock_context); + AiksContext renderer(mock_context, nullptr); std::shared_ptr image = picture.ToImage(renderer, {301, 301}); ASSERT_EQ(spy->render_passes_.size(), 1llu); @@ -2243,7 +2243,7 @@ TEST_P(AiksTest, ClipRectElidesNoOpClips) { std::shared_ptr spy = ContextSpy::Make(); std::shared_ptr real_context = GetContext(); std::shared_ptr mock_context = spy->MakeContext(real_context); - AiksContext renderer(mock_context); + AiksContext renderer(mock_context, nullptr); std::shared_ptr image = picture.ToImage(renderer, {300, 300}); ASSERT_EQ(spy->render_passes_.size(), 1llu); diff --git a/impeller/display_list/dl_playground.cc b/impeller/display_list/dl_playground.cc index 539b32f6a7a6b..b6d1f5468fe1e 100644 --- a/impeller/display_list/dl_playground.cc +++ b/impeller/display_list/dl_playground.cc @@ -7,6 +7,7 @@ #include "flutter/testing/testing.h" #include "impeller/aiks/aiks_context.h" #include "impeller/display_list/dl_dispatcher.h" +#include "impeller/typographer/backends/skia/text_render_context_skia.h" #include "third_party/imgui/imgui.h" #include "third_party/skia/include/core/SkData.h" @@ -29,7 +30,7 @@ bool DlPlayground::OpenPlaygroundHere(DisplayListPlaygroundCallback callback) { return true; } - AiksContext context(GetContext()); + AiksContext context(GetContext(), TextRenderContextSkia::Make()); if (!context.IsValid()) { return false; } diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index 94fd796a7eed2..6f76a60ab8eb2 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -16,6 +16,7 @@ #include "impeller/renderer/render_pass.h" #include "impeller/renderer/render_target.h" #include "impeller/tessellator/tessellator.h" +#include "impeller/typographer/text_render_context.h" namespace impeller { @@ -159,9 +160,12 @@ static std::unique_ptr CreateDefaultPipeline( return std::make_unique(context, desc); } -ContentContext::ContentContext(std::shared_ptr context) +ContentContext::ContentContext( + std::shared_ptr context, + std::shared_ptr text_render_context) : context_(std::move(context)), - lazy_glyph_atlas_(std::make_shared()), + lazy_glyph_atlas_( + std::make_shared(std::move(text_render_context))), tessellator_(std::make_shared()), scene_context_(std::make_shared(context_)), render_target_cache_(std::make_shared( diff --git a/impeller/entity/contents/content_context.h b/impeller/entity/contents/content_context.h index 86da8f98b2287..3c67f85c66fc4 100644 --- a/impeller/entity/contents/content_context.h +++ b/impeller/entity/contents/content_context.h @@ -19,6 +19,7 @@ #include "impeller/renderer/pipeline.h" #include "impeller/renderer/render_target.h" #include "impeller/scene/scene_context.h" +#include "impeller/typographer/text_render_context.h" #ifdef IMPELLER_DEBUG #include "impeller/entity/checkerboard.frag.h" @@ -339,7 +340,9 @@ class RenderTargetCache; class ContentContext { public: - explicit ContentContext(std::shared_ptr context); + explicit ContentContext( + std::shared_ptr context, + std::shared_ptr text_render_context); ~ContentContext(); diff --git a/impeller/entity/contents/text_contents.cc b/impeller/entity/contents/text_contents.cc index 26a5db145c258..9267771b9c59c 100644 --- a/impeller/entity/contents/text_contents.cc +++ b/impeller/entity/contents/text_contents.cc @@ -12,10 +12,8 @@ #include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/content_context.h" #include "impeller/entity/entity.h" -#include "impeller/geometry/path_builder.h" #include "impeller/renderer/render_pass.h" #include "impeller/renderer/sampler_library.h" -#include "impeller/tessellator/tessellator.h" #include "impeller/typographer/glyph_atlas.h" #include "impeller/typographer/lazy_glyph_atlas.h" @@ -30,12 +28,12 @@ void TextContents::SetTextFrame(const TextFrame& frame) { } std::shared_ptr TextContents::ResolveAtlas( + Context& context, GlyphAtlas::Type type, - const std::shared_ptr& lazy_atlas, - std::shared_ptr context) const { + const std::shared_ptr& lazy_atlas) const { FML_DCHECK(lazy_atlas); if (lazy_atlas) { - return lazy_atlas->CreateOrGetGlyphAtlas(type, std::move(context)); + return lazy_atlas->CreateOrGetGlyphAtlas(context, type); } return nullptr; @@ -90,7 +88,7 @@ bool TextContents::Render(const ContentContext& renderer, auto type = frame_.GetAtlasType(); auto atlas = - ResolveAtlas(type, renderer.GetLazyGlyphAtlas(), renderer.GetContext()); + ResolveAtlas(*renderer.GetContext(), type, renderer.GetLazyGlyphAtlas()); if (!atlas || !atlas->IsValid()) { VALIDATION_LOG << "Cannot render glyphs without prepared atlas."; diff --git a/impeller/entity/contents/text_contents.h b/impeller/entity/contents/text_contents.h index 4499586735a7d..70f83d10e45ae 100644 --- a/impeller/entity/contents/text_contents.h +++ b/impeller/entity/contents/text_contents.h @@ -63,9 +63,9 @@ class TextContents final : public Contents { Vector2 offset_; std::shared_ptr ResolveAtlas( + Context& context, GlyphAtlas::Type type, - const std::shared_ptr& lazy_atlas, - std::shared_ptr context) const; + const std::shared_ptr& lazy_atlas) const; FML_DISALLOW_COPY_AND_ASSIGN(TextContents); }; diff --git a/impeller/entity/entity_playground.cc b/impeller/entity/entity_playground.cc index abdb428e200da..103dfab02f4f6 100644 --- a/impeller/entity/entity_playground.cc +++ b/impeller/entity/entity_playground.cc @@ -5,21 +5,27 @@ #include "impeller/entity/entity_playground.h" #include "impeller/entity/contents/content_context.h" - +#include "impeller/typographer/backends/skia/text_render_context_skia.h" #include "third_party/imgui/imgui.h" namespace impeller { -EntityPlayground::EntityPlayground() = default; +EntityPlayground::EntityPlayground() + : text_render_context_(TextRenderContextSkia::Make()) {} EntityPlayground::~EntityPlayground() = default; +void EntityPlayground::SetTextRenderContext( + std::shared_ptr text_render_context) { + text_render_context_ = std::move(text_render_context); +} + bool EntityPlayground::OpenPlaygroundHere(EntityPass& entity_pass) { if (!switches_.enable_playground) { return true; } - ContentContext content_context(GetContext()); + ContentContext content_context(GetContext(), text_render_context_); if (!content_context.IsValid()) { return false; } @@ -35,7 +41,7 @@ bool EntityPlayground::OpenPlaygroundHere(Entity entity) { return true; } - ContentContext content_context(GetContext()); + ContentContext content_context(GetContext(), text_render_context_); if (!content_context.IsValid()) { return false; } @@ -50,7 +56,7 @@ bool EntityPlayground::OpenPlaygroundHere(EntityPlaygroundCallback callback) { return true; } - ContentContext content_context(GetContext()); + ContentContext content_context(GetContext(), text_render_context_); if (!content_context.IsValid()) { return false; } diff --git a/impeller/entity/entity_playground.h b/impeller/entity/entity_playground.h index a2f05876497c3..d9d83259b710f 100644 --- a/impeller/entity/entity_playground.h +++ b/impeller/entity/entity_playground.h @@ -4,12 +4,13 @@ #pragma once +#include "impeller/playground/playground_test.h" + #include "flutter/fml/macros.h" #include "impeller/entity/contents/content_context.h" #include "impeller/entity/entity.h" #include "impeller/entity/entity_pass.h" - -#include "impeller/playground/playground_test.h" +#include "impeller/typographer/text_render_context.h" namespace impeller { @@ -22,6 +23,9 @@ class EntityPlayground : public PlaygroundTest { ~EntityPlayground(); + void SetTextRenderContext( + std::shared_ptr text_render_context); + bool OpenPlaygroundHere(Entity entity); bool OpenPlaygroundHere(EntityPass& entity_pass); @@ -29,6 +33,8 @@ class EntityPlayground : public PlaygroundTest { bool OpenPlaygroundHere(EntityPlaygroundCallback callback); private: + std::shared_ptr text_render_context_; + FML_DISALLOW_COPY_AND_ASSIGN(EntityPlayground); }; diff --git a/impeller/entity/entity_unittests.cc b/impeller/entity/entity_unittests.cc index 35194d5541d0a..90edc60222883 100644 --- a/impeller/entity/entity_unittests.cc +++ b/impeller/entity/entity_unittests.cc @@ -2175,7 +2175,8 @@ TEST_P(EntityTest, InheritOpacityTest) { font.setSize(30); auto blob = SkTextBlob::MakeFromString("A", font); auto frame = TextFrameFromTextBlob(blob); - auto lazy_glyph_atlas = std::make_shared(); + auto lazy_glyph_atlas = + std::make_shared(TextRenderContextSkia::Make()); lazy_glyph_atlas->AddTextFrame(frame, 1.0f); auto text_contents = std::make_shared(); diff --git a/impeller/golden_tests/golden_playground_test.h b/impeller/golden_tests/golden_playground_test.h index a165fdd103189..34f879c0d225f 100644 --- a/impeller/golden_tests/golden_playground_test.h +++ b/impeller/golden_tests/golden_playground_test.h @@ -11,6 +11,7 @@ #include "flutter/impeller/playground/playground.h" #include "flutter/impeller/renderer/render_target.h" #include "flutter/testing/testing.h" +#include "impeller/typographer/text_render_context.h" #if FML_OS_MACOSX #include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h" @@ -26,12 +27,17 @@ class GoldenPlaygroundTest GoldenPlaygroundTest(); + ~GoldenPlaygroundTest() override; + void SetUp(); void TearDown(); PlaygroundBackend GetBackend() const; + void SetTextRenderContext( + std::shared_ptr text_render_context); + bool OpenPlaygroundHere(const Picture& picture); bool OpenPlaygroundHere(const AiksPlaygroundCallback& callback); @@ -58,6 +64,8 @@ class GoldenPlaygroundTest fml::ScopedNSAutoreleasePool autorelease_pool_; #endif + std::shared_ptr text_render_context_; + struct GoldenPlaygroundTestImpl; // This is only a shared_ptr so it can work with a forward declared type. std::shared_ptr pimpl_; diff --git a/impeller/golden_tests/golden_playground_test_mac.cc b/impeller/golden_tests/golden_playground_test_mac.cc index 55209e7836746..0b57755dba6e8 100644 --- a/impeller/golden_tests/golden_playground_test_mac.cc +++ b/impeller/golden_tests/golden_playground_test_mac.cc @@ -4,12 +4,15 @@ #include #include +#include #include "flutter/impeller/golden_tests/golden_playground_test.h" #include "flutter/impeller/aiks/picture.h" #include "flutter/impeller/golden_tests/golden_digest.h" #include "flutter/impeller/golden_tests/metal_screenshoter.h" +#include "impeller/typographer/backends/skia/text_render_context_skia.h" +#include "impeller/typographer/text_render_context.h" namespace impeller { @@ -85,7 +88,15 @@ struct GoldenPlaygroundTest::GoldenPlaygroundTestImpl { }; GoldenPlaygroundTest::GoldenPlaygroundTest() - : pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {} + : text_render_context_(TextRenderContextSkia::Make()), + pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {} + +GoldenPlaygroundTest::~GoldenPlaygroundTest() = default; + +void GoldenPlaygroundTest::SetTextRenderContext( + std::shared_ptr text_render_context) { + text_render_context_ = std::move(text_render_context); +}; void GoldenPlaygroundTest::TearDown() { ASSERT_FALSE(dlopen("/usr/local/lib/libMoltenVK.dylib", RTLD_NOLOAD)); @@ -124,8 +135,10 @@ PlaygroundBackend GoldenPlaygroundTest::GetBackend() const { } bool GoldenPlaygroundTest::OpenPlaygroundHere(const Picture& picture) { - auto screenshot = - pimpl_->screenshoter->MakeScreenshot(picture, pimpl_->window_size); + AiksContext renderer(GetContext(), text_render_context_); + + auto screenshot = pimpl_->screenshoter->MakeScreenshot(renderer, picture, + pimpl_->window_size); return SaveScreenshot(std::move(screenshot)); } @@ -161,7 +174,7 @@ std::shared_ptr GoldenPlaygroundTest::OpenAssetAsRuntimeStage( } std::shared_ptr GoldenPlaygroundTest::GetContext() const { - return pimpl_->screenshoter->GetContext().GetContext(); + return pimpl_->screenshoter->GetPlayground().GetContext(); } Point GoldenPlaygroundTest::GetContentScale() const { diff --git a/impeller/golden_tests/golden_playground_test_stub.cc b/impeller/golden_tests/golden_playground_test_stub.cc index 054dc5553e624..44da5a642e0b2 100644 --- a/impeller/golden_tests/golden_playground_test_stub.cc +++ b/impeller/golden_tests/golden_playground_test_stub.cc @@ -6,7 +6,14 @@ namespace impeller { -GoldenPlaygroundTest::GoldenPlaygroundTest() {} +GoldenPlaygroundTest::GoldenPlaygroundTest() = default; + +GoldenPlaygroundTest::~GoldenPlaygroundTest() = default; + +void GoldenPlaygroundTest::SetTextRenderContext( + std::shared_ptr text_render_context) { + text_render_context_ = std::move(text_render_context); +}; void GoldenPlaygroundTest::TearDown() {} diff --git a/impeller/golden_tests/golden_tests.cc b/impeller/golden_tests/golden_tests.cc index c99d9abc05852..d57bbf751d5d5 100644 --- a/impeller/golden_tests/golden_tests.cc +++ b/impeller/golden_tests/golden_tests.cc @@ -7,6 +7,7 @@ #include #include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h" +#include "impeller/aiks/aiks_context.h" #include "impeller/aiks/canvas.h" #include "impeller/entity/contents/conical_gradient_contents.h" #include "impeller/geometry/path_builder.h" @@ -56,7 +57,7 @@ class GoldenTests : public ::testing::Test { void SetUp() override { testing::GoldenDigest::Instance()->AddDimension( "gpu_string", - Screenshoter().GetContext().GetContext()->DescribeGpuModel()); + Screenshoter().GetPlayground().GetContext()->DescribeGpuModel()); } private: @@ -79,7 +80,10 @@ TEST_F(GoldenTests, ConicalGradient) { paint.style = Paint::Style::kFill; canvas.DrawRect(Rect(10, 10, 250, 250), paint); Picture picture = canvas.EndRecordingAsPicture(); - auto screenshot = Screenshoter().MakeScreenshot(picture); + + auto aiks_context = + AiksContext(Screenshoter().GetPlayground().GetContext(), nullptr); + auto screenshot = Screenshoter().MakeScreenshot(aiks_context, picture); ASSERT_TRUE(SaveScreenshot(std::move(screenshot))); } } // namespace testing diff --git a/impeller/golden_tests/metal_screenshoter.h b/impeller/golden_tests/metal_screenshoter.h index 217c5bc774b3d..961d3186f5c81 100644 --- a/impeller/golden_tests/metal_screenshoter.h +++ b/impeller/golden_tests/metal_screenshoter.h @@ -12,24 +12,20 @@ namespace impeller { namespace testing { -/// Converts `Picture`'s to `MetalScreenshot`'s with the playground backend. +/// Converts `Picture`s to `MetalScreenshot`s with the playground backend. class MetalScreenshoter { public: MetalScreenshoter(); - std::unique_ptr MakeScreenshot(const Picture& picture, + std::unique_ptr MakeScreenshot(AiksContext& aiks_context, + const Picture& picture, const ISize& size = {300, 300}); - AiksContext& GetContext() { return *aiks_context_; } - - const AiksContext& GetContext() const { return *aiks_context_; } - const PlaygroundImpl& GetPlayground() const { return *playground_; } private: std::unique_ptr playground_; - std::unique_ptr aiks_context_; }; } // namespace testing diff --git a/impeller/golden_tests/metal_screenshoter.mm b/impeller/golden_tests/metal_screenshoter.mm index acf41f07a200c..1d01b65386a8a 100644 --- a/impeller/golden_tests/metal_screenshoter.mm +++ b/impeller/golden_tests/metal_screenshoter.mm @@ -17,15 +17,15 @@ FML_CHECK(::glfwInit() == GLFW_TRUE); playground_ = PlaygroundImpl::Create(PlaygroundBackend::kMetal, PlaygroundSwitches{}); - aiks_context_.reset(new AiksContext(playground_->GetContext())); } std::unique_ptr MetalScreenshoter::MakeScreenshot( + AiksContext& aiks_context, const Picture& picture, const ISize& size) { Vector2 content_scale = playground_->GetContentScale(); std::shared_ptr image = picture.ToImage( - *aiks_context_, + aiks_context, ISize(size.width * content_scale.x, size.height * content_scale.y)); std::shared_ptr texture = image->GetTexture(); id metal_texture = diff --git a/impeller/renderer/compute_subgroup_unittests.cc b/impeller/renderer/compute_subgroup_unittests.cc index 8c9cc4fba14ec..bec4030735911 100644 --- a/impeller/renderer/compute_subgroup_unittests.cc +++ b/impeller/renderer/compute_subgroup_unittests.cc @@ -125,7 +125,7 @@ TEST_P(ComputeSubgroupTest, PathPlayground) { } ImGui::End(); - ContentContext renderer(context); + ContentContext renderer(context, nullptr); if (!renderer.IsValid()) { return false; } @@ -329,7 +329,7 @@ TEST_P(ComputeSubgroupTest, LargePath) { ->count; }); - ContentContext renderer(context); + ContentContext renderer(context, nullptr); if (!renderer.IsValid()) { return false; } @@ -413,7 +413,7 @@ TEST_P(ComputeSubgroupTest, QuadAndCubicInOnePath) { ASSERT_EQ(status, ComputeTessellator::Status::kOk); auto callback = [&](RenderPass& pass) -> bool { - ContentContext renderer(context); + ContentContext renderer(context, nullptr); if (!renderer.IsValid()) { return false; } diff --git a/impeller/typographer/backends/skia/text_render_context_skia.cc b/impeller/typographer/backends/skia/text_render_context_skia.cc index 1dca003c66a23..89554e555f8ea 100644 --- a/impeller/typographer/backends/skia/text_render_context_skia.cc +++ b/impeller/typographer/backends/skia/text_render_context_skia.cc @@ -12,11 +12,10 @@ #include "impeller/core/allocator.h" #include "impeller/typographer/backends/skia/typeface_skia.h" #include "impeller/typographer/rectangle_packer.h" +#include "impeller/typographer/text_render_context.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkFont.h" -#include "third_party/skia/include/core/SkFontMetrics.h" -#include "third_party/skia/include/core/SkRSXform.h" #include "third_party/skia/include/core/SkSurface.h" namespace impeller { @@ -24,19 +23,16 @@ namespace impeller { using FontGlyphPairRefVector = std::vector>; -std::unique_ptr TextRenderContext::Create( - std::shared_ptr context) { - // There is only one backend today. - return std::make_unique(std::move(context)); -} - // TODO(bdero): We might be able to remove this per-glyph padding if we fix // the underlying causes of the overlap. // https://github.com/flutter/flutter/issues/114563 constexpr auto kPadding = 2; -TextRenderContextSkia::TextRenderContextSkia(std::shared_ptr context) - : TextRenderContext(std::move(context)) {} +std::shared_ptr TextRenderContextSkia::Make() { + return std::make_shared(); +} + +TextRenderContextSkia::TextRenderContextSkia() = default; TextRenderContextSkia::~TextRenderContextSkia() = default; @@ -310,6 +306,7 @@ static std::shared_ptr UploadGlyphTextureAtlas( } std::shared_ptr TextRenderContextSkia::CreateGlyphAtlas( + Context& context, GlyphAtlas::Type type, std::shared_ptr atlas_context, const FontGlyphPair::Set& font_glyph_pairs) const { @@ -429,8 +426,8 @@ std::shared_ptr TextRenderContextSkia::CreateGlyphAtlas( format = PixelFormat::kR8G8B8A8UNormInt; break; } - auto texture = UploadGlyphTextureAtlas(GetContext()->GetResourceAllocator(), - bitmap, atlas_size, format); + auto texture = UploadGlyphTextureAtlas(context.GetResourceAllocator(), bitmap, + atlas_size, format); if (!texture) { return nullptr; } diff --git a/impeller/typographer/backends/skia/text_render_context_skia.h b/impeller/typographer/backends/skia/text_render_context_skia.h index 2e2e6ad97cf8b..32d5a083c2dd9 100644 --- a/impeller/typographer/backends/skia/text_render_context_skia.h +++ b/impeller/typographer/backends/skia/text_render_context_skia.h @@ -11,12 +11,15 @@ namespace impeller { class TextRenderContextSkia : public TextRenderContext { public: - TextRenderContextSkia(std::shared_ptr context); + static std::shared_ptr Make(); + + TextRenderContextSkia(); ~TextRenderContextSkia() override; // |TextRenderContext| std::shared_ptr CreateGlyphAtlas( + Context& context, GlyphAtlas::Type type, std::shared_ptr atlas_context, const FontGlyphPair::Set& font_glyph_pairs) const override; diff --git a/impeller/typographer/lazy_glyph_atlas.cc b/impeller/typographer/lazy_glyph_atlas.cc index f98f8af6d62b3..85f7c5dce0da2 100644 --- a/impeller/typographer/lazy_glyph_atlas.cc +++ b/impeller/typographer/lazy_glyph_atlas.cc @@ -11,8 +11,10 @@ namespace impeller { -LazyGlyphAtlas::LazyGlyphAtlas() - : alpha_context_(std::make_shared()), +LazyGlyphAtlas::LazyGlyphAtlas( + std::shared_ptr text_render_context) + : text_render_context_(std::move(text_render_context)), + alpha_context_(std::make_shared()), color_context_(std::make_shared()) {} LazyGlyphAtlas::~LazyGlyphAtlas() = default; @@ -33,8 +35,8 @@ void LazyGlyphAtlas::ResetTextFrames() { } std::shared_ptr LazyGlyphAtlas::CreateOrGetGlyphAtlas( - GlyphAtlas::Type type, - std::shared_ptr context) const { + Context& context, + GlyphAtlas::Type type) const { { auto atlas_it = atlas_map_.find(type); if (atlas_it != atlas_map_.end()) { @@ -42,14 +44,22 @@ std::shared_ptr LazyGlyphAtlas::CreateOrGetGlyphAtlas( } } - auto text_context = TextRenderContext::Create(std::move(context)); - if (!text_context || !text_context->IsValid()) { + if (!text_render_context_) { + VALIDATION_LOG << "Unable to render text because a TextRenderContext has " + "not been set."; return nullptr; } + if (!text_render_context_->IsValid()) { + VALIDATION_LOG + << "Unable to render text because the TextRenderContext is invalid."; + return nullptr; + } + auto& set = type == GlyphAtlas::Type::kAlphaBitmap ? alpha_set_ : color_set_; auto atlas_context = type == GlyphAtlas::Type::kAlphaBitmap ? alpha_context_ : color_context_; - auto atlas = text_context->CreateGlyphAtlas(type, atlas_context, set); + auto atlas = + text_render_context_->CreateGlyphAtlas(context, type, atlas_context, set); if (!atlas || !atlas->IsValid()) { VALIDATION_LOG << "Could not create valid atlas."; return nullptr; diff --git a/impeller/typographer/lazy_glyph_atlas.h b/impeller/typographer/lazy_glyph_atlas.h index 7289538eb4be9..f29dbfea6e506 100644 --- a/impeller/typographer/lazy_glyph_atlas.h +++ b/impeller/typographer/lazy_glyph_atlas.h @@ -10,12 +10,14 @@ #include "impeller/renderer/context.h" #include "impeller/typographer/glyph_atlas.h" #include "impeller/typographer/text_frame.h" +#include "impeller/typographer/text_render_context.h" namespace impeller { class LazyGlyphAtlas { public: - LazyGlyphAtlas(); + explicit LazyGlyphAtlas( + std::shared_ptr text_render_context); ~LazyGlyphAtlas(); @@ -24,10 +26,12 @@ class LazyGlyphAtlas { void ResetTextFrames(); std::shared_ptr CreateOrGetGlyphAtlas( - GlyphAtlas::Type type, - std::shared_ptr context) const; + Context& context, + GlyphAtlas::Type type) const; private: + std::shared_ptr text_render_context_; + FontGlyphPair::Set alpha_set_; FontGlyphPair::Set color_set_; std::shared_ptr alpha_context_; diff --git a/impeller/typographer/text_render_context.cc b/impeller/typographer/text_render_context.cc index 1b7aba10a7b74..8476b62c7b6aa 100644 --- a/impeller/typographer/text_render_context.cc +++ b/impeller/typographer/text_render_context.cc @@ -8,11 +8,7 @@ namespace impeller { -TextRenderContext::TextRenderContext(std::shared_ptr context) - : context_(std::move(context)) { - if (!context_ || !context_->IsValid()) { - return; - } +TextRenderContext::TextRenderContext() { is_valid_ = true; } @@ -22,8 +18,4 @@ bool TextRenderContext::IsValid() const { return is_valid_; } -const std::shared_ptr& TextRenderContext::GetContext() const { - return context_; -} - } // namespace impeller diff --git a/impeller/typographer/text_render_context.h b/impeller/typographer/text_render_context.h index d909388105f93..754e9c26bb5c0 100644 --- a/impeller/typographer/text_render_context.h +++ b/impeller/typographer/text_render_context.h @@ -10,7 +10,6 @@ #include "flutter/fml/macros.h" #include "impeller/renderer/context.h" #include "impeller/typographer/glyph_atlas.h" -#include "impeller/typographer/text_frame.h" namespace impeller { @@ -23,24 +22,15 @@ namespace impeller { /// class TextRenderContext { public: - static std::unique_ptr Create( - std::shared_ptr context); - virtual ~TextRenderContext(); virtual bool IsValid() const; - //---------------------------------------------------------------------------- - /// @brief Get the underlying graphics context. - /// - /// @return The context. - /// - const std::shared_ptr& GetContext() const; - // TODO(dnfield): Callers should not need to know which type of atlas to // create. https://github.com/flutter/flutter/issues/111640 virtual std::shared_ptr CreateGlyphAtlas( + Context& context, GlyphAtlas::Type type, std::shared_ptr atlas_context, const FontGlyphPair::Set& font_glyph_pairs) const = 0; @@ -50,12 +40,9 @@ class TextRenderContext { /// @brief Create a new context to render text that talks to an /// underlying graphics context. /// - /// @param[in] context The graphics context - /// - TextRenderContext(std::shared_ptr context); + TextRenderContext(); private: - std::shared_ptr context_; bool is_valid_ = false; FML_DISALLOW_COPY_AND_ASSIGN(TextRenderContext); diff --git a/impeller/typographer/typographer_unittests.cc b/impeller/typographer/typographer_unittests.cc index 02e8e790f8367..09c78daea06b3 100644 --- a/impeller/typographer/typographer_unittests.cc +++ b/impeller/typographer/typographer_unittests.cc @@ -8,7 +8,6 @@ #include "impeller/typographer/backends/skia/text_render_context_skia.h" #include "impeller/typographer/lazy_glyph_atlas.h" #include "impeller/typographer/rectangle_packer.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkFontMgr.h" #include "third_party/skia/include/core/SkRect.h" @@ -24,14 +23,16 @@ using TypographerTest = PlaygroundTest; INSTANTIATE_PLAYGROUND_SUITE(TypographerTest); static std::shared_ptr CreateGlyphAtlas( - const TextRenderContext* context, + Context& context, + const TextRenderContext* text_render_context, GlyphAtlas::Type type, Scalar scale, const std::shared_ptr& atlas_context, const TextFrame& frame) { FontGlyphPair::Set set; frame.CollectUniqueFontGlyphPairs(set, scale); - return context->CreateGlyphAtlas(type, atlas_context, set); + return text_render_context->CreateGlyphAtlas(context, type, atlas_context, + set); } TEST_P(TypographerTest, CanConvertTextBlob) { @@ -48,20 +49,20 @@ TEST_P(TypographerTest, CanConvertTextBlob) { } TEST_P(TypographerTest, CanCreateRenderContext) { - auto context = TextRenderContext::Create(GetContext()); + auto context = TextRenderContextSkia::Make(); ASSERT_TRUE(context && context->IsValid()); } TEST_P(TypographerTest, CanCreateGlyphAtlas) { - auto context = TextRenderContext::Create(GetContext()); + auto context = TextRenderContextSkia::Make(); auto atlas_context = std::make_shared(); ASSERT_TRUE(context && context->IsValid()); SkFont sk_font; auto blob = SkTextBlob::MakeFromString("hello", sk_font); ASSERT_TRUE(blob); - auto atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob)); + auto atlas = CreateGlyphAtlas(*GetContext(), context.get(), + GlyphAtlas::Type::kAlphaBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob)); ASSERT_NE(atlas, nullptr); ASSERT_NE(atlas->GetTexture(), nullptr); ASSERT_EQ(atlas->GetType(), GlyphAtlas::Type::kAlphaBitmap); @@ -111,7 +112,7 @@ TEST_P(TypographerTest, LazyAtlasTracksColor) { ASSERT_FALSE(frame.GetAtlasType() == GlyphAtlas::Type::kColorBitmap); - LazyGlyphAtlas lazy_atlas; + LazyGlyphAtlas lazy_atlas(TextRenderContextSkia::Make()); lazy_atlas.AddTextFrame(frame, 1.0f); @@ -123,24 +124,24 @@ TEST_P(TypographerTest, LazyAtlasTracksColor) { // Creates different atlases for color and alpha bitmap. auto color_atlas = lazy_atlas.CreateOrGetGlyphAtlas( - GlyphAtlas::Type::kColorBitmap, GetContext()); + *GetContext(), GlyphAtlas::Type::kColorBitmap); auto bitmap_atlas = lazy_atlas.CreateOrGetGlyphAtlas( - GlyphAtlas::Type::kAlphaBitmap, GetContext()); + *GetContext(), GlyphAtlas::Type::kAlphaBitmap); ASSERT_FALSE(color_atlas == bitmap_atlas); } TEST_P(TypographerTest, GlyphAtlasWithOddUniqueGlyphSize) { - auto context = TextRenderContext::Create(GetContext()); + auto context = TextRenderContextSkia::Make(); auto atlas_context = std::make_shared(); ASSERT_TRUE(context && context->IsValid()); SkFont sk_font; auto blob = SkTextBlob::MakeFromString("AGH", sk_font); ASSERT_TRUE(blob); - auto atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob)); + auto atlas = CreateGlyphAtlas(*GetContext(), context.get(), + GlyphAtlas::Type::kAlphaBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob)); ASSERT_NE(atlas, nullptr); ASSERT_NE(atlas->GetTexture(), nullptr); @@ -149,30 +150,30 @@ TEST_P(TypographerTest, GlyphAtlasWithOddUniqueGlyphSize) { } TEST_P(TypographerTest, GlyphAtlasIsRecycledIfUnchanged) { - auto context = TextRenderContext::Create(GetContext()); + auto context = TextRenderContextSkia::Make(); auto atlas_context = std::make_shared(); ASSERT_TRUE(context && context->IsValid()); SkFont sk_font; auto blob = SkTextBlob::MakeFromString("spooky skellingtons", sk_font); ASSERT_TRUE(blob); - auto atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob)); + auto atlas = CreateGlyphAtlas(*GetContext(), context.get(), + GlyphAtlas::Type::kAlphaBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob)); ASSERT_NE(atlas, nullptr); ASSERT_NE(atlas->GetTexture(), nullptr); ASSERT_EQ(atlas, atlas_context->GetGlyphAtlas()); // now attempt to re-create an atlas with the same text blob. - auto next_atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob)); + auto next_atlas = CreateGlyphAtlas( + *GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob)); ASSERT_EQ(atlas, next_atlas); ASSERT_EQ(atlas_context->GetGlyphAtlas(), atlas); } TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) { - auto context = TextRenderContext::Create(GetContext()); + auto context = TextRenderContextSkia::Make(); auto atlas_context = std::make_shared(); ASSERT_TRUE(context && context->IsValid()); @@ -191,8 +192,9 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) { for (size_t index = 0; index < size_count; index += 1) { TextFrameFromTextBlob(blob).CollectUniqueFontGlyphPairs(set, 0.6 * index); }; - auto atlas = context->CreateGlyphAtlas(GlyphAtlas::Type::kAlphaBitmap, - std::move(atlas_context), set); + auto atlas = + context->CreateGlyphAtlas(*GetContext(), GlyphAtlas::Type::kAlphaBitmap, + std::move(atlas_context), set); ASSERT_NE(atlas, nullptr); ASSERT_NE(atlas->GetTexture(), nullptr); @@ -213,15 +215,15 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) { } TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) { - auto context = TextRenderContext::Create(GetContext()); + auto context = TextRenderContextSkia::Make(); auto atlas_context = std::make_shared(); ASSERT_TRUE(context && context->IsValid()); SkFont sk_font; auto blob = SkTextBlob::MakeFromString("spooky 1", sk_font); ASSERT_TRUE(blob); - auto atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob)); + auto atlas = CreateGlyphAtlas(*GetContext(), context.get(), + GlyphAtlas::Type::kAlphaBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob)); auto old_packer = atlas_context->GetRectPacker(); ASSERT_NE(atlas, nullptr); @@ -233,9 +235,9 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) { // Now create a new glyph atlas with a nearly identical blob. auto blob2 = SkTextBlob::MakeFromString("spooky 2", sk_font); - auto next_atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob2)); + auto next_atlas = CreateGlyphAtlas( + *GetContext(), context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob2)); ASSERT_EQ(atlas, next_atlas); auto* second_texture = next_atlas->GetTexture().get(); @@ -246,15 +248,15 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) { } TEST_P(TypographerTest, GlyphAtlasTextureIsRecreatedIfTypeChanges) { - auto context = TextRenderContext::Create(GetContext()); + auto context = TextRenderContextSkia::Make(); auto atlas_context = std::make_shared(); ASSERT_TRUE(context && context->IsValid()); SkFont sk_font; auto blob = SkTextBlob::MakeFromString("spooky 1", sk_font); ASSERT_TRUE(blob); - auto atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kAlphaBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob)); + auto atlas = CreateGlyphAtlas(*GetContext(), context.get(), + GlyphAtlas::Type::kAlphaBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob)); auto old_packer = atlas_context->GetRectPacker(); ASSERT_NE(atlas, nullptr); @@ -267,9 +269,9 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecreatedIfTypeChanges) { // but change the type. auto blob2 = SkTextBlob::MakeFromString("spooky 1", sk_font); - auto next_atlas = - CreateGlyphAtlas(context.get(), GlyphAtlas::Type::kColorBitmap, 1.0f, - atlas_context, TextFrameFromTextBlob(blob2)); + auto next_atlas = CreateGlyphAtlas( + *GetContext(), context.get(), GlyphAtlas::Type::kColorBitmap, 1.0f, + atlas_context, TextFrameFromTextBlob(blob2)); ASSERT_NE(atlas, next_atlas); auto* second_texture = next_atlas->GetTexture().get(); diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index bb05e4475f998..d413edf6ac2cb 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -25,9 +25,10 @@ #include "flutter/fml/time/time_point.h" #if IMPELLER_SUPPORTS_RENDERING // GN is having trouble understanding how this works in the Fuchsia builds. -#include "flutter/impeller/aiks/aiks_context.h" // nogncheck -#include "flutter/impeller/renderer/context.h" // nogncheck -#endif // IMPELLER_SUPPORTS_RENDERING +#include "impeller/aiks/aiks_context.h" // nogncheck +#include "impeller/renderer/context.h" // nogncheck +#include "impeller/typographer/backends/skia/text_render_context_skia.h" // nogncheck +#endif // IMPELLER_SUPPORTS_RENDERING #include "flutter/lib/ui/snapshot_delegate.h" #include "flutter/shell/common/pipeline.h" #include "flutter/shell/common/snapshot_controller.h" @@ -544,7 +545,8 @@ class Rasterizer final : public SnapshotDelegate, return surface_->GetAiksContext(); } if (auto context = impeller_context_.lock()) { - return std::make_shared(context); + return std::make_shared( + context, impeller::TextRenderContextSkia::Make()); } #endif return nullptr; diff --git a/shell/gpu/gpu_surface_gl_impeller.cc b/shell/gpu/gpu_surface_gl_impeller.cc index 84372944eb6d4..6cb4faa8dbed1 100644 --- a/shell/gpu/gpu_surface_gl_impeller.cc +++ b/shell/gpu/gpu_surface_gl_impeller.cc @@ -5,9 +5,10 @@ #include "flutter/shell/gpu/gpu_surface_gl_impeller.h" #include "flutter/fml/make_copyable.h" -#include "flutter/impeller/display_list/dl_dispatcher.h" -#include "flutter/impeller/renderer/backend/gles/surface_gles.h" -#include "flutter/impeller/renderer/renderer.h" +#include "impeller/display_list/dl_dispatcher.h" +#include "impeller/renderer/backend/gles/surface_gles.h" +#include "impeller/renderer/renderer.h" +#include "impeller/typographer/backends/skia/text_render_context_skia.h" namespace flutter { @@ -28,7 +29,8 @@ GPUSurfaceGLImpeller::GPUSurfaceGLImpeller( return; } - auto aiks_context = std::make_shared(context); + auto aiks_context = std::make_shared( + context, impeller::TextRenderContextSkia::Make()); if (!aiks_context->IsValid()) { return; diff --git a/shell/gpu/gpu_surface_metal_impeller.mm b/shell/gpu/gpu_surface_metal_impeller.mm index 2db00a25dc4fd..c95e53599b57e 100644 --- a/shell/gpu/gpu_surface_metal_impeller.mm +++ b/shell/gpu/gpu_surface_metal_impeller.mm @@ -11,8 +11,9 @@ #include "flutter/fml/make_copyable.h" #include "flutter/fml/mapping.h" #include "flutter/fml/trace_event.h" -#include "flutter/impeller/display_list/dl_dispatcher.h" -#include "flutter/impeller/renderer/backend/metal/surface_mtl.h" +#include "impeller/display_list/dl_dispatcher.h" +#include "impeller/renderer/backend/metal/surface_mtl.h" +#include "impeller/typographer/backends/skia/text_render_context_skia.h" static_assert(!__has_feature(objc_arc), "ARC must be disabled."); @@ -35,7 +36,8 @@ render_target_type_(delegate->GetRenderTargetType()), impeller_renderer_(CreateImpellerRenderer(context)), aiks_context_( - std::make_shared(impeller_renderer_ ? context : nullptr)), + std::make_shared(impeller_renderer_ ? context : nullptr, + impeller::TextRenderContextSkia::Make())), render_to_surface_(render_to_surface) { // If this preference is explicitly set, we allow for disabling partial repaint. NSNumber* disablePartialRepaint = diff --git a/shell/gpu/gpu_surface_vulkan_impeller.cc b/shell/gpu/gpu_surface_vulkan_impeller.cc index 42c5f1d53c61e..4ffc92afdb10d 100644 --- a/shell/gpu/gpu_surface_vulkan_impeller.cc +++ b/shell/gpu/gpu_surface_vulkan_impeller.cc @@ -5,10 +5,11 @@ #include "flutter/shell/gpu/gpu_surface_vulkan_impeller.h" #include "flutter/fml/make_copyable.h" -#include "flutter/impeller/display_list/dl_dispatcher.h" -#include "flutter/impeller/renderer/renderer.h" +#include "impeller/display_list/dl_dispatcher.h" #include "impeller/renderer/backend/vulkan/surface_context_vk.h" +#include "impeller/renderer/renderer.h" #include "impeller/renderer/surface.h" +#include "impeller/typographer/backends/skia/text_render_context_skia.h" namespace flutter { @@ -23,7 +24,8 @@ GPUSurfaceVulkanImpeller::GPUSurfaceVulkanImpeller( return; } - auto aiks_context = std::make_shared(context); + auto aiks_context = std::make_shared( + context, impeller::TextRenderContextSkia::Make()); if (!aiks_context->IsValid()) { return; }