Flutter Engine
gpu_surface_software_delegate.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_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_
6 #define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_
7 
8 #include "flutter/flow/embedded_views.h"
9 #include "flutter/fml/macros.h"
10 #include "third_party/skia/include/core/SkSurface.h"
11 
12 namespace flutter {
13 
14 //------------------------------------------------------------------------------
15 /// @brief Interface implemented by all platform surfaces that can present
16 /// a software backing store to the "screen". The GPU surface
17 /// abstraction (which abstracts the client rendering API) uses this
18 /// delegation pattern to tell the platform surface (which abstracts
19 /// how backing stores fulfilled by the selected client rendering
20 /// API end up on the "screen" on a particular platform) when the
21 /// rasterizer needs to allocate and present the software backing
22 /// store.
23 ///
24 /// @see |IOSSurfaceSoftware|, |AndroidSurfaceSoftware|,
25 /// |EmbedderSurfaceSoftware|.
26 ///
28  public:
30 
31  //----------------------------------------------------------------------------
32  /// @brief Called when the GPU surface needs a new buffer to render a new
33  /// frame into.
34  ///
35  /// @param[in] size The size of the frame.
36  ///
37  /// @return A raster surface returned by the platform.
38  ///
39  virtual sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) = 0;
40 
41  //----------------------------------------------------------------------------
42  /// @brief Called by the platform when a frame has been rendered into the
43  /// backing store and the platform must display it on-screen.
44  ///
45  /// @param[in] backing_store The software backing store to present.
46  ///
47  /// @return Returns if the platform could present the backing store onto
48  /// the screen.
49  ///
50  virtual bool PresentBackingStore(sk_sp<SkSurface> backing_store) = 0;
51 };
52 
53 } // namespace flutter
54 
55 #endif // FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_
virtual sk_sp< SkSurface > AcquireBackingStore(const SkISize &size)=0
Called when the GPU surface needs a new buffer to render a new frame into.
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
Interface implemented by all platform surfaces that can present a software backing store to the "scre...
virtual bool PresentBackingStore(sk_sp< SkSurface > backing_store)=0
Called by the platform when a frame has been rendered into the backing store and the platform must di...