diff options
author | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-13 21:27:50 +0000 |
---|---|---|
committer | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-13 21:27:50 +0000 |
commit | b5e2a733b00cfc62f9f9380087ae9227f93ea0d3 (patch) | |
tree | 825a139bc3731768eaa374b92a30096781ff084d | |
parent | 0bf8178f57cfb394e872cc78df125bca3dbc0f11 (diff) | |
download | chromium_src-b5e2a733b00cfc62f9f9380087ae9227f93ea0d3.zip chromium_src-b5e2a733b00cfc62f9f9380087ae9227f93ea0d3.tar.gz chromium_src-b5e2a733b00cfc62f9f9380087ae9227f93ea0d3.tar.bz2 |
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
-rw-r--r-- | ui/compositor/compositor.cc | 19 | ||||
-rw-r--r-- | ui/compositor/compositor.h | 5 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc | 5 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_win.h | 1 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler.cc | 3 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler_delegate.h | 3 |
6 files changed, 19 insertions, 17 deletions
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 5a1cf87..b5fb62a 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -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; diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index bc5cefd..ad00a41 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -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_; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index 1ecd996..45ef06b 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -907,6 +907,11 @@ bool DesktopWindowTreeHostWin::HandleScrollEvent( return event.handled(); } +void DesktopWindowTreeHostWin::HandleWindowSizeChanging() { + if (compositor()) + compositor()->FinishAllRendering(); +} + //////////////////////////////////////////////////////////////////////////////// // DesktopWindowTreeHostWin, private: diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h index 5883141..aa18bdd 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -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; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index ec3cacf..54a479a 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -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. diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h index 87b9a96..e17bf78 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h @@ -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() {} }; |