Remove dependency to most of libutils
Most of libutils is replaced by using the STL,
this is fine in this case because none of it
leaks out of EGL’s internals.
Test: compiled & run
Bug: vndk-stable
Change-Id: I42ded4043ddc98ed7eaa975fbbb2e754cd3219af
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index b553d71..7ed34be 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -60,21 +60,24 @@
egl_connection_t const* cnx) :
egl_object_t(dpy), surface(surface), config(config), win(win), cnx(cnx),
connected(true)
-{}
+{
+ if (win) {
+ win->incStrong(this);
+ }
+}
egl_surface_t::~egl_surface_t() {
- ANativeWindow* const window = win.get();
- if (window != NULL) {
+ if (win != NULL) {
disconnect();
+ win->decStrong(this);
}
}
void egl_surface_t::disconnect() {
- ANativeWindow* const window = win.get();
- if (window != NULL && connected) {
- native_window_set_buffers_format(window, 0);
- if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) {
- ALOGW("EGLNativeWindowType %p disconnect failed", window);
+ if (win != NULL && connected) {
+ native_window_set_buffers_format(win, 0);
+ if (native_window_api_disconnect(win, NATIVE_WINDOW_API_EGL)) {
+ ALOGW("EGLNativeWindowType %p disconnect failed", win);
}
connected = false;
}
@@ -107,22 +110,20 @@
* add the extensions always handled by the wrapper
*/
- if (gl_extensions.isEmpty()) {
+ if (gl_extensions.empty()) {
// call the implementation's glGetString(GL_EXTENSIONS)
const char* exts = (const char *)gEGLImpl.hooks[version]->gl.glGetString(GL_EXTENSIONS);
- gl_extensions.setTo(exts);
- if (gl_extensions.find("GL_EXT_debug_marker") < 0) {
- String8 temp("GL_EXT_debug_marker ");
- temp.append(gl_extensions);
- gl_extensions.setTo(temp);
+ gl_extensions = exts;
+ if (gl_extensions.find("GL_EXT_debug_marker") != std::string::npos) {
+ gl_extensions.insert(0, "GL_EXT_debug_marker ");
}
// tokenize the supported extensions for the glGetStringi() wrapper
std::stringstream ss;
std::string str;
- ss << gl_extensions.string();
+ ss << gl_extensions;
while (ss >> str) {
- tokenized_gl_extensions.push(String8(str.c_str()));
+ tokenized_gl_extensions.push_back(str);
}
}
}