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 pathnull_rasterizer.cc
67 lines (53 loc) · 1.81 KB
/
null_rasterizer.cc
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
// Copyright 2016 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.
#include "flutter/shell/common/null_rasterizer.h"
namespace shell {
NullRasterizer::NullRasterizer() : weak_factory_(this) {}
void NullRasterizer::Setup(
std::unique_ptr<Surface> surface_or_null,
fxl::Closure rasterizer_continuation,
fxl::AutoResetWaitableEvent* setup_completion_event) {
surface_ = std::move(surface_or_null);
rasterizer_continuation();
setup_completion_event->Signal();
}
void NullRasterizer::Teardown(
fxl::AutoResetWaitableEvent* teardown_completion_event) {
if (surface_) {
surface_.reset();
}
teardown_completion_event->Signal();
}
fml::WeakPtr<Rasterizer> NullRasterizer::GetWeakRasterizerPtr() {
return weak_factory_.GetWeakPtr();
}
flow::LayerTree* NullRasterizer::GetLastLayerTree() {
return nullptr;
}
void NullRasterizer::DrawLastLayerTree() {
// Null rasterizer. Nothing to do.
}
flow::TextureRegistry& NullRasterizer::GetTextureRegistry() {
return *texture_registry_;
}
void NullRasterizer::Clear(SkColor color, const SkISize& size) {
// Null rasterizer. Nothing to do.
}
void NullRasterizer::Draw(
fxl::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) {
FXL_ALLOW_UNUSED_LOCAL(
pipeline->Consume([](std::unique_ptr<flow::LayerTree>) {
// Drop the layer tree on the floor. We only need the pipeline empty so
// that frame requests are not deferred indefinitely due to
// backpressure.
}));
}
void NullRasterizer::AddNextFrameCallback(fxl::Closure nextFrameCallback) {
// Null rasterizer. Nothing to do.
}
void NullRasterizer::SetTextureRegistry(
flow::TextureRegistry* textureRegistry) {
texture_registry_ = textureRegistry;
}
} // namespace shell