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

Commit 34236c9

Browse files
authored
Do not use eglQuerySurface to query surface dimensions (#24682)
1 parent 8bec65c commit 34236c9

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

shell/platform/windows/angle_surface_manager.cc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ bool AngleSurfaceManager::CreateSurface(WindowsRenderTarget* render_target,
228228
LogEglError("Surface creation failed.");
229229
}
230230

231+
surface_width_ = width;
232+
surface_height_ = height;
231233
render_surface_ = surface;
232234
return true;
233235
}
@@ -240,19 +242,24 @@ void AngleSurfaceManager::ResizeSurface(WindowsRenderTarget* render_target,
240242
if (width != existing_width || height != existing_height) {
241243
// Resize render_surface_. Internaly this calls mSwapChain->ResizeBuffers
242244
// avoiding the need to destory and recreate the underlying SwapChain.
245+
surface_width_ = width;
246+
surface_height_ = height;
243247
eglPostSubBufferNV(egl_display_, render_surface_, 1, 1, width, height);
244248
}
245249
}
246250

247251
void AngleSurfaceManager::GetSurfaceDimensions(EGLint* width, EGLint* height) {
248252
if (render_surface_ == EGL_NO_SURFACE || !initialize_succeeded_) {
249-
width = 0;
250-
height = 0;
253+
*width = 0;
254+
*height = 0;
251255
return;
252256
}
253257

254-
eglQuerySurface(egl_display_, render_surface_, EGL_WIDTH, width);
255-
eglQuerySurface(egl_display_, render_surface_, EGL_HEIGHT, height);
258+
// Can't use eglQuerySurface here; Because we're not using
259+
// EGL_FIXED_SIZE_ANGLE flag anymore, Angle may resize the surface before
260+
// Flutter asks it to, which breaks resize redraw synchronization
261+
*width = surface_width_;
262+
*height = surface_height_;
256263
}
257264

258265
void AngleSurfaceManager::DestroySurface() {

shell/platform/windows/angle_surface_manager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ class AngleSurfaceManager {
100100

101101
// Current render_surface that engine will draw into.
102102
EGLSurface render_surface_ = EGL_NO_SURFACE;
103+
104+
// Requested dimensions for current surface
105+
EGLint surface_width_ = 0;
106+
EGLint surface_height_ = 0;
103107
};
104108

105109
} // namespace flutter

0 commit comments

Comments
 (0)