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_COMMON_CONTEXT_OPTIONS_H_
6#define FLUTTER_SHELL_COMMON_CONTEXT_OPTIONS_H_
7
8#include <optional>
9
10#include "flutter/fml/macros.h"
11#include "third_party/skia/include/gpu/GrContextOptions.h"
12
13namespace flutter {
14
15enum class ContextType {
16 /// The context is used to render to a texture or renderbuffer.
17 kRender,
18 /// The context will only be used to transfer resources to and from device
19 /// memory. No rendering will be performed using this context.
20 kResource,
21};
22
23//------------------------------------------------------------------------------
24/// @brief Initializes GrContextOptions with values suitable for Flutter.
25/// The options can be further tweaked before a GrContext is created
26/// from these options.
27///
28/// @param[in] type The type of context that will be created using these
29/// options.
30/// @param[in] type The client rendering API that will be wrapped using a
31/// context with these options. This argument is only required
32/// if the context is going to be used with a particular
33/// client rendering API.
34///
35/// @return The default graphics context options.
36///
37GrContextOptions MakeDefaultContextOptions(
38 ContextType type,
39 std::optional<GrBackendApi> api = std::nullopt);
40
41} // namespace flutter
42
43#endif // FLUTTER_SHELL_COMMON_CONTEXT_OPTIONS_H_
44

source code of flutter_engine/flutter/shell/common/context_options.h