Commit 4596251c authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Adjust frame pixel width in phantom window

Since the width is given in pixels which is correct
only on the display with the same DSF, the width needs to
be multiplied by phanton window scale / source scale.

BUG=861967
TEST=Manual. See bug for repro step.

Change-Id: Ib073bb705d8998cf07f41f9d646f0c23828b48de
Reviewed-on: https://chromium-review.googlesource.com/1130595Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573550}
parent 2f732ebf
...@@ -125,11 +125,14 @@ void DefaultFrameHeader::DoPaintHeader(gfx::Canvas* canvas) { ...@@ -125,11 +125,14 @@ void DefaultFrameHeader::DoPaintHeader(gfx::Canvas* canvas) {
flags.setAntiAlias(true); flags.setAntiAlias(true);
if (width_in_pixels_ > 0) { if (width_in_pixels_ > 0) {
canvas->Save(); canvas->Save();
float scale = canvas->UndoDeviceScaleFactor(); float layer_scale =
gfx::Rect rect = ScaleToEnclosingRect(GetPaintedBounds(), scale, scale); target_widget()->GetNativeWindow()->layer()->device_scale_factor();
float canvas_scale = canvas->UndoDeviceScaleFactor();
rect.set_width(width_in_pixels_); gfx::Rect rect =
TileRoundRect(canvas, flags, rect, static_cast<int>(corner_radius * scale)); ScaleToEnclosingRect(GetPaintedBounds(), canvas_scale, canvas_scale);
rect.set_width(width_in_pixels_ * canvas_scale / layer_scale);
TileRoundRect(canvas, flags, rect,
static_cast<int>(corner_radius * canvas_scale));
canvas->Restore(); canvas->Restore();
} else { } else {
TileRoundRect(canvas, flags, GetPaintedBounds(), corner_radius); TileRoundRect(canvas, flags, GetPaintedBounds(), corner_radius);
......
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