GrAHardwareBufferUtils.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #include "include/core/SkTypes.h"
  10. #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
  11. #include "include/gpu/GrBackendSurface.h"
  12. #include "include/gpu/GrTypes.h"
  13. class GrContext;
  14. extern "C" {
  15. typedef struct AHardwareBuffer AHardwareBuffer;
  16. }
  17. namespace GrAHardwareBufferUtils {
  18. SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat);
  19. GrBackendFormat GetBackendFormat(GrContext* context, AHardwareBuffer* hardwareBuffer,
  20. uint32_t bufferFormat, bool requireKnownFormat);
  21. typedef void* DeleteImageCtx;
  22. typedef void (*DeleteImageProc)(DeleteImageCtx);
  23. GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwareBuffer,
  24. int width, int height,
  25. DeleteImageProc* deleteProc,
  26. DeleteImageCtx* deleteCtx,
  27. bool isProtectedContent,
  28. const GrBackendFormat& backendFormat,
  29. bool isRenderable);
  30. } // GrAHardwareBufferUtils
  31. #endif
  32. #endif