Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1f08def

Browse files
authored
Improve resize (#24428)
1 parent e893457 commit 1f08def

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

shell/platform/windows/angle_surface_manager.cc

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,7 @@ bool AngleSurfaceManager::CreateSurface(WindowsRenderTarget* render_target,
205205

206206
EGLSurface surface = EGL_NO_SURFACE;
207207

208-
// Disable Angle's automatic surface sizing logic and provide and exlicit
209-
// size. AngleSurfaceManager is responsible for initiating Angle surface size
210-
// changes to avoid race conditions with rendering when automatic mode is
211-
// used.
212-
const EGLint surfaceAttributes[] = {
213-
EGL_FIXED_SIZE_ANGLE, EGL_TRUE, EGL_WIDTH, width,
214-
EGL_HEIGHT, height, EGL_NONE};
208+
const EGLint surfaceAttributes[] = {EGL_NONE};
215209

216210
#ifdef WINUWP
217211
#ifdef USECOREWINDOW
@@ -244,19 +238,9 @@ void AngleSurfaceManager::ResizeSurface(WindowsRenderTarget* render_target,
244238
EGLint existing_width, existing_height;
245239
GetSurfaceDimensions(&existing_width, &existing_height);
246240
if (width != existing_width || height != existing_height) {
247-
// Destroy existing surface with previous stale dimensions and create new
248-
// surface at new size. Since the Windows compositor retains the front
249-
// buffer until the new surface has been presented, no need to manually
250-
// preserve the previous surface contents. This resize approach could be
251-
// further optimized if Angle exposed a public entrypoint for
252-
// SwapChain11::reset or SwapChain11::resize.
253-
// a possible starting point for that could build on
254-
// eglPostSubBufferNV(egl_display_, render_surface_, 1, 1, width, height);
255-
DestroySurface();
256-
if (!CreateSurface(render_target, width, height)) {
257-
std::cerr << "AngleSurfaceManager::ResizeSurface failed to create surface"
258-
<< std::endl;
259-
}
241+
// Resize render_surface_. Internaly this calls mSwapChain->ResizeBuffers
242+
// avoiding the need to destory and recreate the underlying SwapChain.
243+
eglPostSubBufferNV(egl_display_, render_surface_, 1, 1, width, height);
260244
}
261245
}
262246

shell/platform/windows/flutter_window_winuwp.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,17 @@ double FlutterWindowWinUWP::GetPosY(
245245
void FlutterWindowWinUWP::OnBoundsChanged(
246246
winrt::Windows::UI::ViewManagement::ApplicationView const& app_view,
247247
winrt::Windows::Foundation::IInspectable const&) {
248-
#ifndef USECOREWINDOW
249248
if (binding_handler_delegate_) {
250249
auto bounds = GetBounds(current_display_info_, true);
251250

252251
binding_handler_delegate_->OnWindowSizeChanged(
253252
static_cast<size_t>(bounds.width), static_cast<size_t>(bounds.height));
253+
#ifndef USECOREWINDOW
254+
254255
render_target_.Size({bounds.width, bounds.height});
255-
}
256+
256257
#endif
258+
}
257259
}
258260

259261
void FlutterWindowWinUWP::OnKeyUp(

0 commit comments

Comments
 (0)