protected sealed override void CreateDrawingSurface() { if (glSurface == IntPtr.Zero) { // create the surface glSurface = Evas.evas_gl_surface_create(glEvas, glConfigPtr, surfaceSize.Width, surfaceSize.Height); // copy the native surface to the image Evas.evas_gl_native_surface_get(glEvas, glSurface, out var nativeSurface); Evas.evas_object_image_native_surface_set(evasImage, ref nativeSurface); // switch to the current OpenGL context Evas.evas_gl_make_current(glEvas, glSurface, glContext); // resize the viewport Gles.glViewport(0, 0, surfaceSize.Width, surfaceSize.Height); // create the interface using the function pointers provided by the EFL var glInterface = GRGlInterface.CreateNativeEvasInterface(glEvas); context?.Dispose(); context = GRContext.Create(GRBackend.OpenGL, glInterface); // create the render target renderTarget?.Dispose(); renderTarget = SKGLDrawable.CreateRenderTarget(surfaceSize.Width, surfaceSize.Height); // create the surface surface?.Dispose(); surface = SKSurface.Create(context, renderTarget, GRSurfaceOrigin.BottomLeft, SKImageInfo.PlatformColorType); } }
private void CreateSurface() { if (glSurface == IntPtr.Zero) { // create the surface glSurface = Evas.evas_gl_surface_create(glEvas, glConfigPtr, renderTarget.Width, renderTarget.Height); // copy the native surface to the image Evas.NativeSurfaceOpenGL nativeSurface; Evas.evas_gl_native_surface_get(glEvas, glSurface, out nativeSurface); Evas.evas_object_image_native_surface_set(evasImage, ref nativeSurface); // switch to the current OpenGL context Evas.evas_gl_make_current(glEvas, glSurface, glContext); // resize the viewport Gles.glViewport(0, 0, renderTarget.Width, renderTarget.Height); // initialize the Skia's context CreateContext(); // copy the properties of the current surface var currentRenderTarget = SKGLDrawable.CreateRenderTarget(); renderTarget.SampleCount = currentRenderTarget.SampleCount; renderTarget.StencilBits = currentRenderTarget.StencilBits; renderTarget.RenderTargetHandle = currentRenderTarget.RenderTargetHandle; } }