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