@@ -214,7 +214,13 @@ bool AngleSurfaceManager::CreateSurface(WindowsRenderTarget* render_target,
214214
215215 EGLSurface surface = EGL_NO_SURFACE;
216216
217+ #ifdef WINUWP
217218 const EGLint surfaceAttributes[] = {EGL_NONE};
219+ #else
220+ const EGLint surfaceAttributes[] = {
221+ EGL_FIXED_SIZE_ANGLE, EGL_TRUE, EGL_WIDTH, width,
222+ EGL_HEIGHT, height, EGL_NONE};
223+ #endif
218224
219225#ifdef WINUWP
220226#ifdef USECOREWINDOW
@@ -249,11 +255,26 @@ void AngleSurfaceManager::ResizeSurface(WindowsRenderTarget* render_target,
249255 EGLint existing_width, existing_height;
250256 GetSurfaceDimensions (&existing_width, &existing_height);
251257 if (width != existing_width || height != existing_height) {
252- // Resize render_surface_. Internaly this calls mSwapChain->ResizeBuffers
253- // avoiding the need to destroy and recreate the underlying SwapChain.
254258 surface_width_ = width;
255259 surface_height_ = height;
260+
261+ // TODO(clarkezone) convert ifdef to use use final implementation of angle
262+ // resize API prototyped here
263+ // https://github.com/clarkezone/angle/tree/resizeswapchaintest to eliminate
264+ // unnecessary surface creation / desctruction by use ResizeSwapchain
265+ // https://github.com/flutter/flutter/issues/79427
266+ #ifdef WINUWP
267+ // Resize render_surface_. Internaly this calls mSwapChain->ResizeBuffers
268+ // avoiding the need to destory and recreate the underlying SwapChain.
256269 eglPostSubBufferNV (egl_display_, render_surface_, 1 , 1 , width, height);
270+ #else
271+ ClearContext ();
272+ DestroySurface ();
273+ if (!CreateSurface (render_target, width, height)) {
274+ std::cerr << " AngleSurfaceManager::ResizeSurface failed to create surface"
275+ << std::endl;
276+ }
277+ #endif
257278 }
258279}
259280
0 commit comments