public bool CreateSurface()

in source/SkiaSharp.Views/SkiaSharp.Views/Platform/Android/GLTextureView.cs [557:604]


			public bool CreateSurface()
			{
				LogDebug($"[GLThread {CurrentThreadId}][EglHelper] CreateSurface");

				if (egl == null)
				{
					throw new Exception("egl not initialized");
				}
				if (eglDisplay == null)
				{
					throw new Exception("eglDisplay not initialized");
				}
				if (eglConfig == null)
				{
					throw new Exception("mEglConfig not initialized");
				}
				// The window size has changed, so we need to create a new surface.
				DestroySurfaceImpl();

				// Create an EGL surface we can render into.
				if (textureViewWeakRef.TryGetTarget(out GLTextureView view))
				{
					eglSurface = view.eglWindowSurfaceFactory.CreateWindowSurface(egl, eglDisplay, eglConfig, view.SurfaceTexture);
				}
				else
				{
					eglSurface = null;
				}
				if (eglSurface == null || eglSurface == EGL10.EglNoSurface)
				{
					var error = egl.EglGetError();
					if (error == EGL10.EglBadNativeWindow)
					{
						LogError($"[GLThread {CurrentThreadId}][EglHelper] createWindowSurface returned EGL_BAD_NATIVE_WINDOW");
					}
					return false;
				}
				// Before we can issue IGL commands, we need to make sure the context is 
				// current and bound to a surface.
				if (!egl.EglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext))
				{
					// Could not make the context current, probably because the underlying
					// TextureView surface has been destroyed.
					LogError($"[GLThread {CurrentThreadId}][EglHelper] eglMakeCurrent failed: {egl.EglGetError()}");
					return false;
				}
				return true;
			}