mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Context creation options for each backend were spread across multiple translation units. This makes setting options common across all backends hard to configure. I have moved the creation of such common options into a separate translation unit. Fixes https://github.com/flutter/flutter/issues/84213
44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
// 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_COMMON_CONTEXT_OPTIONS_H_
|
|
#define FLUTTER_SHELL_COMMON_CONTEXT_OPTIONS_H_
|
|
|
|
#include <optional>
|
|
|
|
#include "flutter/fml/macros.h"
|
|
#include "third_party/skia/include/gpu/GrContextOptions.h"
|
|
|
|
namespace flutter {
|
|
|
|
enum class ContextType {
|
|
/// The context is used to render to a texture or renderbuffer.
|
|
kRender,
|
|
/// The context will only be used to transfer resources to and from device
|
|
/// memory. No rendering will be performed using this context.
|
|
kResource,
|
|
};
|
|
|
|
//------------------------------------------------------------------------------
|
|
/// @brief Initializes GrContextOptions with values suitable for Flutter.
|
|
/// The options can be further tweaked before a GrContext is created
|
|
/// from these options.
|
|
///
|
|
/// @param[in] type The type of context that will be created using these
|
|
/// options.
|
|
/// @param[in] type The client rendering API that will be wrapped using a
|
|
/// context with these options. This argument is only required
|
|
/// if the context is going to be used with a particular
|
|
/// client rendering API.
|
|
///
|
|
/// @return The default graphics context options.
|
|
///
|
|
GrContextOptions MakeDefaultContextOptions(
|
|
ContextType type,
|
|
std::optional<GrBackendApi> api = std::nullopt);
|
|
|
|
} // namespace flutter
|
|
|
|
#endif // FLUTTER_SHELL_COMMON_CONTEXT_OPTIONS_H_
|