| Flutter Impeller |

renderer.h
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 #pragma once
6
7 #include <functional>
8 #include <memory>
9
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/synchronization/semaphore.h"
12 #include "impeller/geometry/size.h"
13 #include "impeller/renderer/context.h"
14 #include "impeller/renderer/render_target.h"
15
16 namespace impeller {
17
18 class Surface;
19 class RenderPass;
20
21 class Renderer {
22 public:
23 static constexpr size_t kDefaultMaxFramesInFlight = 3u;
24
25 using RenderCallback = std::function<bool(RenderTarget& render_target)>;
26
27 Renderer(std::shared_ptr<Context> context,
28 size_t max_frames_in_flight = kDefaultMaxFramesInFlight);
29
30 ~Renderer();
31
32 bool IsValid() const;
33
34 bool Render(std::unique_ptr<Surface> surface,
35 const RenderCallback& callback) const;
36
37 std::shared_ptr<Context> GetContext() const;
38
39 private:
40 std::shared_ptr<fml::Semaphore> frames_in_flight_sema_;
41 std::shared_ptr<Context> context_;
42 bool is_valid_ = false;
43
44 FML_DISALLOW_COPY_AND_ASSIGN(Renderer);
45 };
46
47 } // namespace impeller
impeller::Renderer::~Renderer
~Renderer()
impeller::Renderer::RenderCallback
std::function< bool(RenderTarget &render_target)> RenderCallback
Definition: renderer.h:25
impeller::Renderer::GetContext
std::shared_ptr< Context > GetContext() const
Definition: renderer.cc:63
impeller::Renderer::kDefaultMaxFramesInFlight
static constexpr size_t kDefaultMaxFramesInFlight
Definition: renderer.h:23
impeller::RenderTarget
Definition: render_target.h:48
impeller::Renderer
Definition: renderer.h:21
impeller::Renderer::IsValid
bool IsValid() const
Definition: renderer.cc:31
impeller::Renderer::Renderer
Renderer(std::shared_ptr< Context > context, size_t max_frames_in_flight=kDefaultMaxFramesInFlight)
Definition: renderer.cc:17
impeller::Renderer::Render
bool Render(std::unique_ptr< Surface > surface, const RenderCallback &callback) const
Definition: renderer.cc:35
context.h
render_target.h
impeller
Definition: aiks_context.cc:10
size.h