| Flutter Impeller |

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
5 #include "impeller/entity/contents/anonymous_contents.h"
6
7 #include <memory>
8
9 namespace impeller {
10
11 std::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
17 AnonymousContents::AnonymousContents(RenderProc render_proc,
18 CoverageProc coverage_proc)
19 : render_proc_(std::move(render_proc)),
20 coverage_proc_(std::move(coverage_proc)) {}
21
22 AnonymousContents::~AnonymousContents() = default;
23
24 bool AnonymousContents::Render(const ContentContext& renderer,
25 const Entity& entity,
26 RenderPass& pass) const {
27 return render_proc_(renderer, entity, pass);
28 }
29
30 std::optional<Rect> AnonymousContents::GetCoverage(const Entity& entity) const {
31 return coverage_proc_(entity);
32 }
33
34 } // namespace impeller
anonymous_contents.h
impeller::AnonymousContents
Definition: anonymous_contents.h:14
impeller::AnonymousContents::Make
static std::shared_ptr< Contents > Make(RenderProc render_proc, CoverageProc coverage_proc)
Definition: anonymous_contents.cc:11
impeller::AnonymousContents::~AnonymousContents
~AnonymousContents() override
impeller::AnonymousContents::GetCoverage
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.
Definition: anonymous_contents.cc:30
impeller::AnonymousContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: anonymous_contents.cc:24
impeller::ContentContext
Definition: content_context.h:138
impeller::Contents::CoverageProc
std::function< std::optional< Rect >(const Entity &entity)> CoverageProc
Definition: contents.h:40
impeller::Contents::RenderProc
std::function< bool(const ContentContext &renderer, const Entity &entity, RenderPass &pass)> RenderProc
Definition: contents.h:39
impeller::Entity
Definition: entity.h:26
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:30
impeller
Definition: allocation.cc:12
std
Definition: comparable.h:95