Loading opengl/libs/EGL/egl_object.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,8 @@ bool egl_object_t::get(egl_display_t const* display, egl_object_t* object) { egl_surface_t::egl_surface_t(egl_display_t* dpy, EGLConfig config, EGLNativeWindowType win, EGLSurface surface, egl_connection_t const* cnx) : egl_object_t(dpy), surface(surface), config(config), win(win), cnx(cnx) egl_object_t(dpy), surface(surface), config(config), win(win), cnx(cnx), connected(true) { if (win) { getDisplay()->onWindowSurfaceCreated(); Loading @@ -77,14 +78,27 @@ egl_surface_t::egl_surface_t(egl_display_t* dpy, EGLConfig config, egl_surface_t::~egl_surface_t() { ANativeWindow* const window = win.get(); if (window != NULL) { disconnect(); getDisplay()->onWindowSurfaceDestroyed(); } } 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); } getDisplay()->onWindowSurfaceDestroyed(); connected = false; } } void egl_surface_t::terminate() { disconnect(); egl_object_t::terminate(); } // ---------------------------------------------------------------------------- egl_context_t::egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config, Loading opengl/libs/EGL/egl_object.h +5 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ class egl_object_t { protected: virtual ~egl_object_t(); virtual void terminate(); public: egl_object_t(egl_display_t* display); Loading @@ -55,7 +56,6 @@ public: inline egl_display_t* getDisplay() const { return display; } private: void terminate(); static bool get(egl_display_t const* display, egl_object_t* object); public: Loading Loading @@ -127,6 +127,7 @@ void egl_object_t::LocalRef<N,T>::terminate() { class egl_surface_t : public egl_object_t { protected: ~egl_surface_t(); void terminate() override; public: typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref; Loading @@ -138,6 +139,9 @@ public: EGLConfig config; sp<ANativeWindow> win; egl_connection_t const* cnx; private: bool connected; void disconnect(); }; class egl_context_t: public egl_object_t { Loading Loading
opengl/libs/EGL/egl_object.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -67,7 +67,8 @@ bool egl_object_t::get(egl_display_t const* display, egl_object_t* object) { egl_surface_t::egl_surface_t(egl_display_t* dpy, EGLConfig config, EGLNativeWindowType win, EGLSurface surface, egl_connection_t const* cnx) : egl_object_t(dpy), surface(surface), config(config), win(win), cnx(cnx) egl_object_t(dpy), surface(surface), config(config), win(win), cnx(cnx), connected(true) { if (win) { getDisplay()->onWindowSurfaceCreated(); Loading @@ -77,14 +78,27 @@ egl_surface_t::egl_surface_t(egl_display_t* dpy, EGLConfig config, egl_surface_t::~egl_surface_t() { ANativeWindow* const window = win.get(); if (window != NULL) { disconnect(); getDisplay()->onWindowSurfaceDestroyed(); } } 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); } getDisplay()->onWindowSurfaceDestroyed(); connected = false; } } void egl_surface_t::terminate() { disconnect(); egl_object_t::terminate(); } // ---------------------------------------------------------------------------- egl_context_t::egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config, Loading
opengl/libs/EGL/egl_object.h +5 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ class egl_object_t { protected: virtual ~egl_object_t(); virtual void terminate(); public: egl_object_t(egl_display_t* display); Loading @@ -55,7 +56,6 @@ public: inline egl_display_t* getDisplay() const { return display; } private: void terminate(); static bool get(egl_display_t const* display, egl_object_t* object); public: Loading Loading @@ -127,6 +127,7 @@ void egl_object_t::LocalRef<N,T>::terminate() { class egl_surface_t : public egl_object_t { protected: ~egl_surface_t(); void terminate() override; public: typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref; Loading @@ -138,6 +139,9 @@ public: EGLConfig config; sp<ANativeWindow> win; egl_connection_t const* cnx; private: bool connected; void disconnect(); }; class egl_context_t: public egl_object_t { Loading