Flutter Engine
The Flutter Engine
anonymous_contents.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
6
7#include <memory>
8
9namespace impeller {
10
11std::shared_ptr<Contents> AnonymousContents::Make(RenderProc render_proc,
12 CoverageProc coverage_proc) {
13 return std::shared_ptr<Contents>(
14 new AnonymousContents(std::move(render_proc), std::move(coverage_proc)));
15}
16
17AnonymousContents::AnonymousContents(RenderProc render_proc,
18 CoverageProc coverage_proc)
19 : render_proc_(std::move(render_proc)),
20 coverage_proc_(std::move(coverage_proc)) {}
21
23
25 const Entity& entity,
26 RenderPass& pass) const {
27 return render_proc_(renderer, entity, pass);
28}
29
30std::optional<Rect> AnonymousContents::GetCoverage(const Entity& entity) const {
31 return coverage_proc_(entity);
32}
33
34} // namespace impeller
static std::shared_ptr< Contents > Make(RenderProc render_proc, CoverageProc coverage_proc)
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
std::function< std::optional< Rect >(const Entity &entity)> CoverageProc
Definition: contents.h:47
std::function< bool(const ContentContext &renderer, const Entity &entity, RenderPass &pass)> RenderProc
Definition: contents.h:46
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
Definition: ref_ptr.h:256