forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpu_surface_software_delegate.h
67 lines (58 loc) · 2.87 KB
/
gpu_surface_software_delegate.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
// Copyright 2013 The Flutter 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 FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_
#define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_
#include "flutter/flow/embedded_views.h"
#include "flutter/fml/macros.h"
#include "third_party/skia/include/core/SkSurface.h"
namespace flutter {
//------------------------------------------------------------------------------
/// @brief Interface implemented by all platform surfaces that can present
/// a software backing store to the "screen". The GPU surface
/// abstraction (which abstracts the client rendering API) uses this
/// delegation pattern to tell the platform surface (which abstracts
/// how backing stores fulfilled by the selected client rendering
/// API end up on the "screen" on a particular platform) when the
/// rasterizer needs to allocate and present the software backing
/// store.
///
/// @see |IOSurfaceSoftware|, |AndroidSurfaceSoftware|,
/// |EmbedderSurfaceSoftware|.
///
class GPUSurfaceSoftwareDelegate {
public:
virtual ~GPUSurfaceSoftwareDelegate();
//----------------------------------------------------------------------------
/// @brief Called when the GPU surface needs a new buffer to render a new
/// frame into.
///
/// @param[in] size The size of the frame.
///
/// @return A raster surface returned by the platform.
///
virtual sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) = 0;
//----------------------------------------------------------------------------
/// @brief Called by the platform when a frame has been rendered into the
/// backing store and the platform must display it on-screen.
///
/// @param[in] backing_store The software backing store to present.
///
/// @return Returns if the platform could present the backing store onto
/// the screen.
///
virtual bool PresentBackingStore(sk_sp<SkSurface> backing_store) = 0;
//----------------------------------------------------------------------------
/// @brief Gets the view embedder that controls how the Flutter layer
/// hierarchy split into multiple chunks should be composited back
/// on-screen. This field is optional and the Flutter rasterizer
/// will render into a single on-screen surface if this call
/// returns a null external view embedder.
///
/// @return The external view embedder, or, null if Flutter is rendering
/// into a single on-screen surface.
///
virtual ExternalViewEmbedder* GetExternalViewEmbedder() = 0;
};
} // namespace flutter
#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_