Commit 095f5f2a authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev Committed by Commit Bot

cros: Take voice interaction service screenshot at 1:1 scale

The screenshot implementation copies the layer tree and inherits
the transform from the root window. When user zoom is applied,
this transform contains scaling which affects the screenshot
size.

Resetting this transform on the copied layer tree root ensures
that the screenshot is taken in screen pixels.

TBR=lhchavez@chromium.org

Bug: 752217
Change-Id: I5278217d0dc0c663b274ac695078c3d3bfff28fd
Reviewed-on: https://chromium-review.googlesource.com/600849
Commit-Queue: Vladislav Kaznacheev <kaznacheev@chromium.org>
Reviewed-by: default avatarVladislav Kaznacheev <kaznacheev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491840}
parent 2909d207
...@@ -122,6 +122,11 @@ std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshot( ...@@ -122,6 +122,11 @@ std::unique_ptr<ui::LayerTreeOwner> CreateLayerTreeForSnapshot(
DCHECK(layer_tree_owner); DCHECK(layer_tree_owner);
auto* root_layer = layer_tree_owner->root(); auto* root_layer = layer_tree_owner->root();
// The root layer might have a scaling transform applied (if the user has
// changed the UI scale via Ctrl-Shift-Plus/Minus).
// Clear the transform so that the snapshot is taken at 1:1 scale relative
// to screen pixels.
root_layer->SetTransform(gfx::Transform());
root_window->layer()->Add(root_layer); root_window->layer()->Add(root_layer);
root_window->layer()->StackAtBottom(root_layer); root_window->layer()->StackAtBottom(root_layer);
return layer_tree_owner; return layer_tree_owner;
......
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