This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
/
Copy pathgpu_rasterizer.h
68 lines (45 loc) · 2.06 KB
/
gpu_rasterizer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHELL_GPU_DIRECT_GPU_RASTERIZER_H_
#define SHELL_GPU_DIRECT_GPU_RASTERIZER_H_
#include "flutter/flow/compositor_context.h"
#include "flutter/shell/common/rasterizer.h"
#include "lib/fxl/memory/weak_ptr.h"
#include "lib/fxl/synchronization/waitable_event.h"
namespace shell {
class Surface;
class GPURasterizer : public Rasterizer {
public:
GPURasterizer(std::unique_ptr<flow::ProcessInfo> info);
~GPURasterizer() override;
void Setup(std::unique_ptr<Surface> surface,
fxl::Closure continuation,
fxl::AutoResetWaitableEvent* setup_completion_event) override;
void Clear(SkColor color, const SkISize& size) override;
void Teardown(
fxl::AutoResetWaitableEvent* teardown_completion_event) override;
fml::WeakPtr<Rasterizer> GetWeakRasterizerPtr() override;
flow::LayerTree* GetLastLayerTree() override;
void DrawLastLayerTree() override;
flow::TextureRegistry& GetTextureRegistry() override;
void Draw(fxl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) override;
// Set a callback to be called once when the next frame is drawn.
void AddNextFrameCallback(fxl::Closure nextFrameCallback) override;
void SetTextureRegistry(flow::TextureRegistry* textureRegistry) override;
private:
std::unique_ptr<Surface> surface_;
flow::CompositorContext compositor_context_;
std::unique_ptr<flow::LayerTree> last_layer_tree_;
// A closure to be called when the underlaying surface presents a frame the
// next time. NULL if there is no callback or the callback was set back to
// NULL after being called.
fxl::Closure nextFrameCallback_;
fml::WeakPtrFactory<GPURasterizer> weak_factory_;
void DoDraw(std::unique_ptr<flow::LayerTree> layer_tree);
void DrawToSurface(flow::LayerTree& layer_tree);
void NotifyNextFrameOnce();
FXL_DISALLOW_COPY_AND_ASSIGN(GPURasterizer);
};
} // namespace shell
#endif // SHELL_GPU_DIRECT_GPU_RASTERIZER_H_