[Impeller] dont accidentally copy shared ptr. (flutter/engine#49731)
Copying the shared ptr when we don't need to results in us incrementing/decrementing the ref count which isn't free.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "impeller/entity/contents/clip_contents.h"
|
||||
#include "impeller/entity/contents/content_context.h"
|
||||
#include "impeller/entity/entity.h"
|
||||
#include "impeller/entity/geometry/geometry.h"
|
||||
#include "impeller/geometry/path.h"
|
||||
#include "impeller/renderer/render_pass.h"
|
||||
|
||||
@@ -38,7 +39,7 @@ std::optional<Rect> SolidColorContents::GetCoverage(
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto geometry = GetGeometry();
|
||||
const std::shared_ptr<Geometry>& geometry = GetGeometry();
|
||||
if (geometry == nullptr) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "impeller/entity/contents/content_context.h"
|
||||
#include "impeller/entity/contents/filters/color_filter_contents.h"
|
||||
#include "impeller/entity/geometry/geometry.h"
|
||||
#include "impeller/entity/geometry/vertices_geometry.h"
|
||||
#include "impeller/entity/position_color.vert.h"
|
||||
#include "impeller/entity/vertices.frag.h"
|
||||
#include "impeller/geometry/color.h"
|
||||
@@ -122,7 +124,7 @@ bool VerticesUVContents::Render(const ContentContext& renderer,
|
||||
Command cmd;
|
||||
DEBUG_COMMAND_INFO(cmd, "VerticesUV");
|
||||
auto& host_buffer = renderer.GetTransientsBuffer();
|
||||
auto geometry = parent_.GetGeometry();
|
||||
const std::shared_ptr<Geometry>& geometry = parent_.GetGeometry();
|
||||
|
||||
auto coverage = src_contents->GetCoverage(Entity{});
|
||||
if (!coverage.has_value()) {
|
||||
@@ -176,7 +178,7 @@ bool VerticesColorContents::Render(const ContentContext& renderer,
|
||||
Command cmd;
|
||||
DEBUG_COMMAND_INFO(cmd, "VerticesColors");
|
||||
auto& host_buffer = renderer.GetTransientsBuffer();
|
||||
auto geometry = parent_.GetGeometry();
|
||||
const std::shared_ptr<VerticesGeometry>& geometry = parent_.GetGeometry();
|
||||
|
||||
auto geometry_result =
|
||||
geometry->GetPositionColorBuffer(renderer, entity, pass);
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "flutter/impeller/entity/geometry/round_rect_geometry.h"
|
||||
|
||||
#include "flutter/impeller/entity/geometry/line_geometry.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
RoundRectGeometry::RoundRectGeometry(const Rect& bounds, const Size& radii)
|
||||
|
||||
Reference in New Issue
Block a user