fix(new_editor): reduce live resize jitter

This commit is contained in:
2026-04-22 21:08:36 +08:00
parent 34c635ba22
commit ad98660b1d
13 changed files with 232 additions and 33 deletions

View File

@@ -1,6 +1,7 @@
#include "Platform/Win32/EditorWindowChromeController.h"
#include "Platform/Win32/EditorWindow.h"
#include "Platform/Win32/EditorWindowFrameDriver.h"
#include "Platform/Win32/EditorWindowRuntimeController.h"
#include "Platform/Win32/EditorWindowState.h"
#include "Platform/Win32/EditorWindowSupport.h"
@@ -137,6 +138,24 @@ bool EditorWindowChromeController::TryGetPredictedClientPixelSize(
return m_runtimeState.TryGetPredictedClientPixelSize(outWidth, outHeight);
}
void EditorWindowChromeController::MarkPredictedClientPixelSizePresented() {
m_runtimeState.MarkPredictedClientPixelSizePresented();
}
bool EditorWindowChromeController::ConsumePresentedPredictedClientPixelSizeMatch(
UINT width,
UINT height) {
return m_runtimeState.ConsumePresentedPredictedClientPixelSizeMatch(width, height);
}
void EditorWindowChromeController::RequestSkipNextSteadyStateFrame() {
m_runtimeState.RequestSkipNextSteadyStateFrame();
}
bool EditorWindowChromeController::ConsumeSkipNextSteadyStateFrame() {
return m_runtimeState.ConsumeSkipNextSteadyStateFrame();
}
void EditorWindowChromeController::SetBorderlessWindowMaximized(bool maximized) {
m_runtimeState.SetBorderlessWindowMaximized(maximized);
}
@@ -297,8 +316,6 @@ bool EditorWindowChromeController::HandleResizePointerMove(
EditorWindow& window,
EditorContext& editorContext,
bool globalTabDragActive) {
(void)editorContext;
(void)globalTabDragActive;
if (!IsBorderlessResizeActive() ||
window.m_state->window.hwnd == nullptr) {
return false;
@@ -326,8 +343,13 @@ bool EditorWindowChromeController::HandleResizePointerMove(
SetPredictedClientPixelSize(
static_cast<UINT>(width),
static_cast<UINT>(height));
window.ApplyWindowResize(static_cast<UINT>(width), static_cast<UINT>(height));
(void)window.RenderFrame(editorContext, globalTabDragActive);
if (window.ApplyWindowResize(static_cast<UINT>(width), static_cast<UINT>(height))) {
(void)EditorWindowFrameDriver::DriveImmediateFrame(
window,
editorContext,
globalTabDragActive);
MarkPredictedClientPixelSizePresented();
}
SetWindowPos(
window.m_state->window.hwnd,
@@ -794,8 +816,6 @@ bool EditorWindowChromeController::ApplyPredictedWindowRectTransition(
EditorContext& editorContext,
bool globalTabDragActive,
const RECT& targetRect) {
(void)editorContext;
(void)globalTabDragActive;
if (window.m_state->window.hwnd == nullptr) {
return false;
}
@@ -807,8 +827,13 @@ bool EditorWindowChromeController::ApplyPredictedWindowRectTransition(
}
SetPredictedClientPixelSize(static_cast<UINT>(width), static_cast<UINT>(height));
window.ApplyWindowResize(static_cast<UINT>(width), static_cast<UINT>(height));
(void)window.RenderFrame(editorContext, globalTabDragActive);
if (window.ApplyWindowResize(static_cast<UINT>(width), static_cast<UINT>(height))) {
(void)EditorWindowFrameDriver::DriveImmediateFrame(
window,
editorContext,
globalTabDragActive);
MarkPredictedClientPixelSizePresented();
}
SetWindowPos(
window.m_state->window.hwnd,
nullptr,