Commit b5e2a733 authored by jbauman@chromium.org's avatar jbauman@chromium.org

Do FinishAllRendering in WM_WINDOWPOSCHANGING

This ensures that the last swap completes before the window is resized, so that the window contents aren't scaled.

BUG=363704

Review URL: https://codereview.chromium.org/277053003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270206 0039d316-1c4b-4281-b951-d872f2087c98
parent 0bf8178f
......@@ -90,7 +90,6 @@ Compositor::Compositor(gfx::AcceleratedWidget widget)
device_scale_factor_(0.0f),
last_started_frame_(0),
last_ended_frame_(0),
next_draw_is_resize_(false),
disable_schedule_composite_(false),
compositor_lock_(NULL),
defer_draw_scheduling_(false),
......@@ -232,18 +231,6 @@ void Compositor::Draw() {
// compositeImmediately() directly.
Layout();
host_->Composite(gfx::FrameTime::Now());
#if defined(OS_WIN)
// While we resize, we are usually a few frames behind. By blocking
// the UI thread here we minize the area that is mis-painted, specially
// in the non-client area. See RenderWidgetHostViewAura::SetBounds for
// more details and bug 177115.
if (next_draw_is_resize_ && (last_ended_frame_ > 1)) {
next_draw_is_resize_ = false;
host_->FinishAllRendering();
}
#endif
}
if (swap_state_ == SWAP_NONE)
NotifyEnd();
......@@ -257,6 +244,10 @@ void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) {
host_->SetNeedsRedrawRect(damage_rect);
}
void Compositor::FinishAllRendering() {
host_->FinishAllRendering();
}
void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) {
scoped_ptr<cc::SwapPromise> swap_promise(
new cc::LatencyInfoSwapPromise(latency_info));
......@@ -269,8 +260,6 @@ void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) {
size_ = size_in_pixel;
host_->SetViewportSize(size_in_pixel);
root_web_layer_->SetBounds(size_in_pixel);
next_draw_is_resize_ = true;
}
if (device_scale_factor_ != scale) {
device_scale_factor_ = scale;
......
......@@ -172,6 +172,9 @@ class COMPOSITOR_EXPORT Compositor
// from changes to layer properties.
void ScheduleRedrawRect(const gfx::Rect& damage_rect);
// Finishes all outstanding rendering on the GPU.
void FinishAllRendering();
void SetLatencyInfo(const LatencyInfo& latency_info);
// Sets the compositor's device scale factor and size.
......@@ -276,8 +279,6 @@ class COMPOSITOR_EXPORT Compositor
int last_started_frame_;
int last_ended_frame_;
bool next_draw_is_resize_;
bool disable_schedule_composite_;
CompositorLock* compositor_lock_;
......
......@@ -907,6 +907,11 @@ bool DesktopWindowTreeHostWin::HandleScrollEvent(
return event.handled();
}
void DesktopWindowTreeHostWin::HandleWindowSizeChanging() {
if (compositor())
compositor()->FinishAllRendering();
}
////////////////////////////////////////////////////////////////////////////////
// DesktopWindowTreeHostWin, private:
......
......@@ -204,6 +204,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
WPARAM w_param,
LPARAM l_param) OVERRIDE;
virtual bool HandleScrollEvent(const ui::ScrollEvent& event) OVERRIDE;
virtual void HandleWindowSizeChanging() OVERRIDE;
Widget* GetWidget();
const Widget* GetWidget() const;
......
......@@ -2224,6 +2224,9 @@ void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) {
}
}
if (DidClientAreaSizeChange(window_pos))
delegate_->HandleWindowSizeChanging();
if (ScopedFullscreenVisibility::IsHiddenForFullscreen(hwnd())) {
// Prevent the window from being made visible if we've been asked to do so.
// See comment in header as to why we might want this.
......
......@@ -233,6 +233,9 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate {
// handled by the delegate.
virtual bool HandleScrollEvent(const ui::ScrollEvent& event) = 0;
// Called when the window size is about to change.
virtual void HandleWindowSizeChanging() = 0;
protected:
virtual ~HWNDMessageHandlerDelegate() {}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment