Remove a dependency of EGL on ui/GraphicBuffer.h
the conversion to a ANativeWindowBuffer is now
handled by libnativewindow.
Test: compiled & run
Bug: cleanup
Change-Id: I52dd64574afbc1eff5bdbefacec234a79f8acd97
diff --git a/libs/nativewindow/AHardwareBuffer.cpp b/libs/nativewindow/AHardwareBuffer.cpp
index 3fbab17..2d9fc93 100644
--- a/libs/nativewindow/AHardwareBuffer.cpp
+++ b/libs/nativewindow/AHardwareBuffer.cpp
@@ -428,6 +428,14 @@
return reinterpret_cast<GraphicBuffer*>(buffer);
}
+const ANativeWindowBuffer* AHardwareBuffer_to_ANativeWindowBuffer(const AHardwareBuffer* buffer) {
+ return AHardwareBuffer_to_GraphicBuffer(buffer)->getNativeBuffer();
+}
+
+ANativeWindowBuffer* AHardwareBuffer_to_ANativeWindowBuffer(AHardwareBuffer* buffer) {
+ return AHardwareBuffer_to_GraphicBuffer(buffer)->getNativeBuffer();
+}
+
AHardwareBuffer* AHardwareBuffer_from_GraphicBuffer(GraphicBuffer* buffer) {
return reinterpret_cast<AHardwareBuffer*>(buffer);
}
diff --git a/libs/nativewindow/include/private/android/AHardwareBufferHelpers.h b/libs/nativewindow/include/private/android/AHardwareBufferHelpers.h
index 612ee80..ee5da84 100644
--- a/libs/nativewindow/include/private/android/AHardwareBufferHelpers.h
+++ b/libs/nativewindow/include/private/android/AHardwareBufferHelpers.h
@@ -28,6 +28,7 @@
#include <stdint.h>
struct AHardwareBuffer;
+struct ANativeWindowBuffer;
namespace android {
@@ -44,8 +45,11 @@
class GraphicBuffer;
const GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(const AHardwareBuffer* buffer);
GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(AHardwareBuffer* buffer);
-AHardwareBuffer* AHardwareBuffer_from_GraphicBuffer(GraphicBuffer* buffer);
+const ANativeWindowBuffer* AHardwareBuffer_to_ANativeWindowBuffer(const AHardwareBuffer* buffer);
+ANativeWindowBuffer* AHardwareBuffer_to_ANativeWindowBuffer(AHardwareBuffer* buffer);
+
+AHardwareBuffer* AHardwareBuffer_from_GraphicBuffer(GraphicBuffer* buffer);
} // namespace android
#endif // ANDROID_PRIVATE_NATIVE_AHARDWARE_BUFFER_HELPERS_H
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index d71837b..9cc96c7 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -33,9 +33,6 @@
#include <cutils/properties.h>
#include <log/log.h>
-#include <ui/GraphicBuffer.h>
-
-
#include <utils/KeyedVector.h>
#include <utils/String8.h>
#include <utils/Trace.h>
@@ -1835,11 +1832,8 @@
EGLClientBuffer eglGetNativeClientBufferANDROID(const AHardwareBuffer *buffer) {
clearError();
-
if (!buffer) return setError(EGL_BAD_PARAMETER, (EGLClientBuffer)0);
-
- const GraphicBuffer* graphicBuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
- return static_cast<EGLClientBuffer>(graphicBuffer->getNativeBuffer());
+ return const_cast<ANativeWindowBuffer *>(AHardwareBuffer_to_ANativeWindowBuffer(buffer));
}
// ----------------------------------------------------------------------------