Commit c68785e2 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

tablet: Remove set opacity of top window before screenshot.

It wasn't working as expected, if the screenshot was kept alive, you
can still see the top window. A patch [1] was added to make this not the
case, but the compositor still draws the frame where the top window
was hidden (seen as a flash) even with compositing locks applied. This
is OK for enter tablet animation as the entire animation will cover
the top window anyways. I will look into a way that works for exit
tablet animation.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1797482

Test: manual
Bug: 948706
Change-Id: Ic3b7843c70a5f71ac5c5ad0c2e7290af81d01551
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1804523
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699519}
parent cf430c01
...@@ -1049,13 +1049,6 @@ void TabletModeController::TakeScreenshot(aura::Window* top_window) { ...@@ -1049,13 +1049,6 @@ void TabletModeController::TakeScreenshot(aura::Window* top_window) {
auto* screenshot_window = top_window->GetRootWindow()->GetChildById( auto* screenshot_window = top_window->GetRootWindow()->GetChildById(
kShellWindowId_ScreenRotationContainer); kShellWindowId_ScreenRotationContainer);
// Pause the compositor and hide the top window before taking a screenshot.
// Use opacity zero instead of show/hide to preserve MRU ordering.
const auto roots = Shell::GetAllRootWindows();
for (auto* root : roots)
root->GetHost()->compositor()->SetAllowLocksToExtendTimeout(true);
top_window->layer()->SetOpacity(0.f);
base::OnceClosure callback = screenshot_set_callback_.callback(); base::OnceClosure callback = screenshot_set_callback_.callback();
// Request a screenshot. // Request a screenshot.
...@@ -1071,9 +1064,6 @@ void TabletModeController::TakeScreenshot(aura::Window* top_window) { ...@@ -1071,9 +1064,6 @@ void TabletModeController::TakeScreenshot(aura::Window* top_window) {
screenshot_request->set_result_selection(request_bounds); screenshot_request->set_result_selection(request_bounds);
screenshot_window->layer()->RequestCopyOfOutput( screenshot_window->layer()->RequestCopyOfOutput(
std::move(screenshot_request)); std::move(screenshot_request));
for (auto* root : roots)
root->GetHost()->compositor()->SetAllowLocksToExtendTimeout(false);
} }
void TabletModeController::OnScreenshotTaken( void TabletModeController::OnScreenshotTaken(
...@@ -1081,8 +1071,6 @@ void TabletModeController::OnScreenshotTaken( ...@@ -1081,8 +1071,6 @@ void TabletModeController::OnScreenshotTaken(
std::unique_ptr<viz::CopyOutputResult> copy_result) { std::unique_ptr<viz::CopyOutputResult> copy_result) {
aura::Window* top_window = aura::Window* top_window =
destroy_observer_ ? destroy_observer_->window() : nullptr; destroy_observer_ ? destroy_observer_->window() : nullptr;
if (top_window)
top_window->layer()->SetOpacity(1.f);
ResetDestroyObserver(); ResetDestroyObserver();
if (!copy_result || copy_result->IsEmpty() || !top_window) { if (!copy_result || copy_result->IsEmpty() || !top_window) {
......
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