| Flutter Impeller |

contents_filter_input.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "impeller/entity/contents/filters/inputs/contents_filter_input.h"
6
7 #include <optional>
8 #include <utility>
9
10 namespace impeller {
11
12 ContentsFilterInput::ContentsFilterInput(std::shared_ptr<Contents> contents,
13 bool msaa_enabled)
14 : contents_(std::move(contents)), msaa_enabled_(msaa_enabled) {}
15
16 ContentsFilterInput::~ContentsFilterInput() = default;
17
18 std::optional<Snapshot> ContentsFilterInput::GetSnapshot(
19 std::string_view label,
20 const ContentContext& renderer,
21 const Entity& entity,
22 std::optional<Rect> coverage_limit,
23 int32_t mip_count) const {
24 if (!coverage_limit.has_value() && entity.GetContents()) {
25 coverage_limit = entity.GetContents()->GetCoverageHint();
26 }
27 if (!snapshot_.has_value()) {
28 snapshot_ = contents_->RenderToSnapshot(renderer, // renderer
29 entity, // entity
30 coverage_limit, // coverage_limit
31 std::nullopt, // sampler_descriptor
32 msaa_enabled_, // msaa_enabled
33 /*mip_count=*/mip_count, //
34 label //
35 );
36 }
37 return snapshot_;
38 }
39
40 std::optional<Rect> ContentsFilterInput::GetCoverage(
41 const Entity& entity) const {
42 return contents_->GetCoverage(entity);
43 }
44
45 } // namespace impeller
impeller::ContentContext
Definition: content_context.h:138
impeller::Entity
Definition: entity.h:26
impeller::Entity::GetContents
const std::shared_ptr< Contents > & GetContents() const
Definition: entity.cc:76
contents_filter_input.h
impeller
Definition: allocation.cc:12
std
Definition: comparable.h:95