|
4 | 4 |
|
5 | 5 | #include <dlfcn.h> |
6 | 6 | #include <filesystem> |
| 7 | +#include <memory> |
7 | 8 |
|
8 | 9 | #include "flutter/impeller/golden_tests/golden_playground_test.h" |
9 | 10 |
|
10 | 11 | #include "flutter/impeller/aiks/picture.h" |
11 | 12 | #include "flutter/impeller/golden_tests/golden_digest.h" |
12 | 13 | #include "flutter/impeller/golden_tests/metal_screenshoter.h" |
13 | 14 | #include "impeller/typographer/backends/skia/text_render_context_skia.h" |
| 15 | +#include "impeller/typographer/text_render_context.h" |
14 | 16 |
|
15 | 17 | namespace impeller { |
16 | 18 |
|
@@ -86,7 +88,15 @@ struct GoldenPlaygroundTest::GoldenPlaygroundTestImpl { |
86 | 88 | }; |
87 | 89 |
|
88 | 90 | GoldenPlaygroundTest::GoldenPlaygroundTest() |
89 | | - : pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {} |
| 91 | + : text_render_context_(TextRenderContextSkia::Make()), |
| 92 | + pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {} |
| 93 | + |
| 94 | +GoldenPlaygroundTest::~GoldenPlaygroundTest() = default; |
| 95 | + |
| 96 | +void GoldenPlaygroundTest::SetTextRenderContext( |
| 97 | + std::shared_ptr<TextRenderContext> text_render_context) { |
| 98 | + text_render_context_ = std::move(text_render_context); |
| 99 | +}; |
90 | 100 |
|
91 | 101 | void GoldenPlaygroundTest::TearDown() { |
92 | 102 | ASSERT_FALSE(dlopen("/usr/local/lib/libMoltenVK.dylib", RTLD_NOLOAD)); |
@@ -124,22 +134,16 @@ PlaygroundBackend GoldenPlaygroundTest::GetBackend() const { |
124 | 134 | return GetParam(); |
125 | 135 | } |
126 | 136 |
|
127 | | -bool GoldenPlaygroundTest::OpenPlaygroundHere( |
128 | | - const Picture& picture, |
129 | | - std::unique_ptr<TextRenderContext> text_render_context_override) { |
130 | | - auto text_context = text_render_context_override |
131 | | - ? std::move(text_render_context_override) |
132 | | - : TextRenderContextSkia::Make(); |
133 | | - AiksContext renderer(GetContext(), std::move(text_context)); |
| 137 | +bool GoldenPlaygroundTest::OpenPlaygroundHere(const Picture& picture) { |
| 138 | + AiksContext renderer(GetContext(), text_render_context_); |
134 | 139 |
|
135 | 140 | auto screenshot = pimpl_->screenshoter->MakeScreenshot(renderer, picture, |
136 | 141 | pimpl_->window_size); |
137 | 142 | return SaveScreenshot(std::move(screenshot)); |
138 | 143 | } |
139 | 144 |
|
140 | 145 | bool GoldenPlaygroundTest::OpenPlaygroundHere( |
141 | | - const AiksPlaygroundCallback& callback, |
142 | | - std::unique_ptr<TextRenderContext> text_render_context_override) { |
| 146 | + const AiksPlaygroundCallback& callback) { |
143 | 147 | return false; |
144 | 148 | } |
145 | 149 |
|
|
0 commit comments