| 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_ =
29 contents_->RenderToSnapshot(renderer, // renderer
30 entity, // entity
31 {
32 .coverage_limit = coverage_limit, //
33 .sampler_descriptor = std::nullopt, //
34 .msaa_enabled = msaa_enabled_, //
35 .mip_count = mip_count, //
36 .label = label //
37 });
38 }
39 return snapshot_;
40 }
41
42 std::optional<Rect> ContentsFilterInput::GetCoverage(
43 const Entity& entity) const {
44 return contents_->GetCoverage(entity);
45 }
46
47 } // namespace impeller
impeller::ContentContext
Definition: content_context.h:122
impeller::Entity
Definition: entity.h:26
impeller::Entity::GetContents
const std::shared_ptr< Contents > & GetContents() const
Definition: entity.cc:78
contents_filter_input.h
impeller
Definition: allocation.cc:12
std
Definition: comparable.h:95