Support GL texture for BGRA8 format
In https://skia-review.googlesource.com/c/skia/+/952216, BGRA8 format is
supported, but GL texture for BGRA8 format isn't supported, so it fails
to create SkImage due to mismatch(colorType is BGRA8, but GL texture is
RGBA8 which is a fall-back type. So add GL texture for BGRA8 as well.
Bug: 403528222
Test: surface with BGRA8, and check if it works well.
Change-Id: I350ef174e04e666765a24697580d4247234615ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/977716
Commit-Queue: Jeongik Cha <jeongik@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jeongik Cha <jeongik@google.com>
diff --git a/src/gpu/ganesh/gl/AHardwareBufferGL.cpp b/src/gpu/ganesh/gl/AHardwareBufferGL.cpp
index 22dc18b..abed997 100644
--- a/src/gpu/ganesh/gl/AHardwareBufferGL.cpp
+++ b/src/gpu/ganesh/gl/AHardwareBufferGL.cpp
@@ -24,7 +24,9 @@
#include <EGL/eglext.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
-
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+#include <vndk/hardware_buffer.h>
+#endif
#define PROT_CONTENT_EXT_STR "EGL_EXT_protected_content"
#define EGL_PROTECTED_CONTENT_EXT 0x32C0
@@ -53,6 +55,10 @@
case AHARDWAREBUFFER_FORMAT_R8_UNORM:
return GrBackendFormats::MakeGL(GR_GL_R8, GR_GL_TEXTURE_EXTERNAL);
#endif
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ case AHARDWAREBUFFER_FORMAT_B8G8R8A8_UNORM:
+ return GrBackendFormats::MakeGL(GR_GL_BGRA8, GR_GL_TEXTURE_EXTERNAL);
+#endif
default:
if (requireKnownFormat) {
return GrBackendFormat();