| 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
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::Entity
Definition: entity.h:21
impeller::AnonymousContents
Definition: anonymous_contents.h:16
impeller::AnonymousContents::Render
bool Render(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
Definition: anonymous_contents.cc:24
anonymous_contents.h
impeller::AnonymousContents::~AnonymousContents
~AnonymousContents() override
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:29
impeller::Contents::RenderProc
std::function< bool(const ContentContext &renderer, const Entity &entity, RenderPass &pass)> RenderProc
Definition: contents.h:49
std
Definition: comparable.h:95
impeller::Contents::CoverageProc
std::function< std::optional< Rect >(const Entity &entity)> CoverageProc
Definition: contents.h:50
impeller
Definition: aiks_context.cc:10
impeller::ContentContext
Definition: content_context.h:332
impeller::AnonymousContents::Make
static std::shared_ptr< Contents > Make(RenderProc render_proc, CoverageProc coverage_proc)
Definition: anonymous_contents.cc:11