Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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"
14
15namespace impeller {
16
17class Surface;
18
19class 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
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_
bool Render(std::unique_ptr< Surface > surface, const RenderCallback &callback) const
Definition renderer.cc:33
static constexpr size_t kDefaultMaxFramesInFlight
Definition renderer.h:21
bool IsValid() const
Definition renderer.cc:29
std::shared_ptr< Context > GetContext() const
Definition renderer.cc:61
std::function< bool(RenderTarget &render_target)> RenderCallback
Definition renderer.h:23
VkSurfaceKHR surface
Definition main.cc:49
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback