[Impeller] Propagate PopulateGlyphAtlas through filters. (flutter/engine#43920)

Resolves https://github.com/flutter/flutter/issues/131012.
This commit is contained in:
Brandon DeRosier
2023-07-22 11:47:10 -07:00
committed by GitHub
parent df90127cd2
commit c0d3d65c06
8 changed files with 44 additions and 0 deletions

View File

@@ -193,6 +193,14 @@ std::optional<Rect> FilterContents::GetCoverage(const Entity& entity) const {
return GetLocalCoverage(entity_with_local_transform);
}
void FilterContents::PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale) {
for (auto& input : inputs_) {
input->PopulateGlyphAtlas(lazy_glyph_atlas, scale);
}
}
std::optional<Rect> FilterContents::GetFilterCoverage(
const FilterInput::Vector& inputs,
const Entity& entity,

View File

@@ -115,6 +115,11 @@ class FilterContents : public Contents {
// |Contents|
std::optional<Rect> GetCoverage(const Entity& entity) const override;
// |Contents|
void PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale) override;
// |Contents|
std::optional<Snapshot> RenderToSnapshot(
const ContentContext& renderer,

View File

@@ -46,4 +46,10 @@ std::optional<Rect> ContentsFilterInput::GetCoverage(
return contents_->GetCoverage(entity);
}
void ContentsFilterInput::PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale) {
contents_->PopulateGlyphAtlas(lazy_glyph_atlas, scale);
}
} // namespace impeller

View File

@@ -25,6 +25,11 @@ class ContentsFilterInput final : public FilterInput {
// |FilterInput|
std::optional<Rect> GetCoverage(const Entity& entity) const override;
// |FilterInput|
void PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale) override;
private:
ContentsFilterInput(std::shared_ptr<Contents> contents, bool msaa_enabled);

View File

@@ -52,4 +52,10 @@ Matrix FilterContentsFilterInput::GetTransform(const Entity& entity) const {
return filter_->GetTransform(entity.GetTransformation());
}
void FilterContentsFilterInput::PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale) {
filter_->PopulateGlyphAtlas(lazy_glyph_atlas, scale);
}
} // namespace impeller

View File

@@ -31,6 +31,11 @@ class FilterContentsFilterInput final : public FilterInput {
// |FilterInput|
Matrix GetTransform(const Entity& entity) const override;
// |FilterInput|
void PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale) override;
private:
FilterContentsFilterInput(std::shared_ptr<FilterContents> filter);

View File

@@ -64,6 +64,10 @@ Matrix FilterInput::GetTransform(const Entity& entity) const {
return entity.GetTransformation() * GetLocalTransform(entity);
}
void FilterInput::PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale) {}
FilterInput::~FilterInput() = default;
} // namespace impeller

View File

@@ -62,6 +62,11 @@ class FilterInput {
/// @brief Get the transform of this `FilterInput`. This is equivalent to
/// calling `entity.GetTransformation() * GetLocalTransform()`.
virtual Matrix GetTransform(const Entity& entity) const;
/// @see `Contents::PopulateGlyphAtlas`
virtual void PopulateGlyphAtlas(
const std::shared_ptr<LazyGlyphAtlas>& lazy_glyph_atlas,
Scalar scale);
};
} // namespace impeller