[Impeller] Simplify CreateContentsForGeometry overloads (flutter/engine#42306)

Came across this while working on generic fallbacks for mask blurs. For
the unique_ptr case, we always capture ownership and convert to a
shared_ptr anyhow. For the shared_ptr case, we always need to capture a
copy, and so better to not take a const ref and allow the caller to move
if possible.
This commit is contained in:
Brandon DeRosier
2023-05-24 20:54:45 -07:00
committed by GitHub
parent c9a0208693
commit 810607e52c
2 changed files with 2 additions and 12 deletions

View File

@@ -27,19 +27,12 @@ std::shared_ptr<Contents> Paint::CreateContentsForEntity(const Path& path,
}
std::shared_ptr<Contents> Paint::CreateContentsForGeometry(
std::unique_ptr<Geometry> geometry) const {
std::shared_ptr<Geometry> geometry) const {
auto contents = color_source.GetContents(*this);
contents->SetGeometry(std::move(geometry));
return contents;
}
std::shared_ptr<Contents> Paint::CreateContentsForGeometry(
const std::shared_ptr<Geometry>& geometry) const {
auto contents = color_source.GetContents(*this);
contents->SetGeometry(geometry);
return contents;
}
std::shared_ptr<Contents> Paint::WithFilters(
std::shared_ptr<Contents> input,
std::optional<bool> is_solid_color) const {

View File

@@ -94,10 +94,7 @@ struct Paint {
bool cover = false) const;
std::shared_ptr<Contents> CreateContentsForGeometry(
std::unique_ptr<Geometry> geometry) const;
std::shared_ptr<Contents> CreateContentsForGeometry(
const std::shared_ptr<Geometry>& geometry) const;
std::shared_ptr<Geometry> geometry) const;
/// @brief Whether this paint has a color filter that can apply opacity
bool HasColorFilter() const;