mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Improve resize (flutter/engine#24428)
This commit is contained in:
parent
822182154d
commit
d7e2d53564
@ -205,13 +205,7 @@ bool AngleSurfaceManager::CreateSurface(WindowsRenderTarget* render_target,
|
||||
|
||||
EGLSurface surface = EGL_NO_SURFACE;
|
||||
|
||||
// Disable Angle's automatic surface sizing logic and provide and exlicit
|
||||
// size. AngleSurfaceManager is responsible for initiating Angle surface size
|
||||
// changes to avoid race conditions with rendering when automatic mode is
|
||||
// used.
|
||||
const EGLint surfaceAttributes[] = {
|
||||
EGL_FIXED_SIZE_ANGLE, EGL_TRUE, EGL_WIDTH, width,
|
||||
EGL_HEIGHT, height, EGL_NONE};
|
||||
const EGLint surfaceAttributes[] = {EGL_NONE};
|
||||
|
||||
#ifdef WINUWP
|
||||
#ifdef USECOREWINDOW
|
||||
@ -244,19 +238,9 @@ void AngleSurfaceManager::ResizeSurface(WindowsRenderTarget* render_target,
|
||||
EGLint existing_width, existing_height;
|
||||
GetSurfaceDimensions(&existing_width, &existing_height);
|
||||
if (width != existing_width || height != existing_height) {
|
||||
// Destroy existing surface with previous stale dimensions and create new
|
||||
// surface at new size. Since the Windows compositor retains the front
|
||||
// buffer until the new surface has been presented, no need to manually
|
||||
// preserve the previous surface contents. This resize approach could be
|
||||
// further optimized if Angle exposed a public entrypoint for
|
||||
// SwapChain11::reset or SwapChain11::resize.
|
||||
// a possible starting point for that could build on
|
||||
// eglPostSubBufferNV(egl_display_, render_surface_, 1, 1, width, height);
|
||||
DestroySurface();
|
||||
if (!CreateSurface(render_target, width, height)) {
|
||||
std::cerr << "AngleSurfaceManager::ResizeSurface failed to create surface"
|
||||
<< std::endl;
|
||||
}
|
||||
// Resize render_surface_. Internaly this calls mSwapChain->ResizeBuffers
|
||||
// avoiding the need to destory and recreate the underlying SwapChain.
|
||||
eglPostSubBufferNV(egl_display_, render_surface_, 1, 1, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -245,15 +245,17 @@ double FlutterWindowWinUWP::GetPosY(
|
||||
void FlutterWindowWinUWP::OnBoundsChanged(
|
||||
winrt::Windows::UI::ViewManagement::ApplicationView const& app_view,
|
||||
winrt::Windows::Foundation::IInspectable const&) {
|
||||
#ifndef USECOREWINDOW
|
||||
if (binding_handler_delegate_) {
|
||||
auto bounds = GetBounds(current_display_info_, true);
|
||||
|
||||
binding_handler_delegate_->OnWindowSizeChanged(
|
||||
static_cast<size_t>(bounds.width), static_cast<size_t>(bounds.height));
|
||||
#ifndef USECOREWINDOW
|
||||
|
||||
render_target_.Size({bounds.width, bounds.height});
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterWindowWinUWP::OnKeyUp(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user