Flutter Engine
The Flutter Engine
SkSurfaceAndroid.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkSurfaceAndroid_DEFINED
9#define SkSurfaceAndroid_DEFINED
10
13#include "include/gpu/GrTypes.h"
14
15class SkColorSpace;
16class GrDirectContext;
17class SkPixmap;
18struct AHardwareBuffer;
19
20namespace SkSurfaces {
21
22/** Private; only to be used by Android Framework.
23 Creates SkSurface from Android hardware buffer.
24 Returned SkSurface takes a reference on the buffer. The ref on the buffer will be released
25 when the SkSurface is destroyed and there is no pending work on the GPU involving the
26 buffer.
27
28 Currently this is only supported for buffers that can be textured as well as rendered to.
29 In other words that must have both AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT and
30 AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE usage bits.
31
32 @param context GPU context
33 @param hardwareBuffer AHardwareBuffer Android hardware buffer
34 @param colorSpace range of colors; may be nullptr
35 @param surfaceProps LCD striping orientation and setting for device independent
36 fonts; may be nullptr
37 @param fromWindow Whether or not the AHardwareBuffer is part of an Android Window.
38 Currently only used with Vulkan backend.
39 @return created SkSurface, or nullptr
40*/
42 AHardwareBuffer* hardwareBuffer,
43 GrSurfaceOrigin origin,
44 sk_sp<SkColorSpace> colorSpace,
45 const SkSurfaceProps* surfaceProps,
46 bool fromWindow = false);
47
48} // namespace SkSurfaces
49
50#endif
struct AHardwareBuffer AHardwareBuffer
GrSurfaceOrigin
Definition: GrTypes.h:147
#define SK_API
Definition: SkAPI.h:35
SK_API sk_sp< SkSurface > WrapAndroidHardwareBuffer(skgpu::graphite::Recorder *recorder, AHardwareBuffer *hardwareBuffer, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, BufferReleaseProc=nullptr, ReleaseContext=nullptr, bool fromWindow=false)