• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 Google Inc.
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 #ifndef GrAHardwareBufferUtils_DEFINED
8 #define GrAHardwareBufferUtils_DEFINED
9 
10 #include "SkTypes.h"
11 
12 #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
13 
14 #include "GrBackendSurface.h"
15 #include "GrTypes.h"
16 
17 class GrContext;
18 
19 extern "C" {
20     typedef struct AHardwareBuffer AHardwareBuffer;
21 }
22 
23 namespace GrAHardwareBufferUtils {
24 
25 SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat);
26 
27 GrBackendFormat GetBackendFormat(GrContext* context, AHardwareBuffer* hardwareBuffer,
28                                  uint32_t bufferFormat, bool requireKnownFormat);
29 
30 typedef void* DeleteImageCtx;
31 typedef void (*DeleteImageProc)(DeleteImageCtx);
32 
33 GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
34                                     int width, int height,
35                                     DeleteImageProc* deleteProc,
36                                     DeleteImageCtx* deleteCtx,
37                                     bool isProtectedContent,
38                                     const GrBackendFormat& backendFormat,
39                                     bool isRenderable);
40 
41 } // GrAHardwareBufferUtils
42 
43 
44 #endif
45 #endif
46