Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions shell/platform/windows/angle_surface_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ bool AngleSurfaceManager::CreateSurface(WindowsRenderTarget* render_target,
LogEglError("Surface creation failed.");
}

surface_width_ = width;
surface_height_ = height;
render_surface_ = surface;
return true;
}
Expand All @@ -240,19 +242,24 @@ void AngleSurfaceManager::ResizeSurface(WindowsRenderTarget* render_target,
if (width != existing_width || height != existing_height) {
// Resize render_surface_. Internaly this calls mSwapChain->ResizeBuffers
// avoiding the need to destory and recreate the underlying SwapChain.
surface_width_ = width;
surface_height_ = height;
eglPostSubBufferNV(egl_display_, render_surface_, 1, 1, width, height);
}
}

void AngleSurfaceManager::GetSurfaceDimensions(EGLint* width, EGLint* height) {
if (render_surface_ == EGL_NO_SURFACE || !initialize_succeeded_) {
width = 0;
height = 0;
*width = 0;
*height = 0;
return;
}

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

void AngleSurfaceManager::DestroySurface() {
Expand Down
4 changes: 4 additions & 0 deletions shell/platform/windows/angle_surface_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ class AngleSurfaceManager {

// Current render_surface that engine will draw into.
EGLSurface render_surface_ = EGL_NO_SURFACE;

// Requested dimensions for current surface
EGLint surface_width_ = 0;
EGLint surface_height_ = 0;
};

} // namespace flutter
Expand Down