Commit a60ad8f6 authored by wez's avatar wez Committed by Commit bot

Account for device scale factor in AppWindow.setShape(), under Windows.

BUG=408728,410593

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

Cr-Commit-Position: refs/heads/master@{#293361}
parent 6a90cafc
......@@ -282,7 +282,28 @@ gfx::Rect DesktopWindowTreeHostWin::GetWorkAreaBoundsInScreen() const {
void DesktopWindowTreeHostWin::SetShape(gfx::NativeRegion native_region) {
if (native_region) {
message_handler_->SetRegion(gfx::CreateHRGNFromSkRegion(*native_region));
// TODO(wez): This would be a lot simpler if we were passed an SkPath.
// See crbug.com/410593.
gfx::NativeRegion shape = native_region;
SkRegion device_region;
if (gfx::IsInHighDPIMode()) {
shape = &device_region;
const float& scale = gfx::GetDPIScale();
std::vector<SkIRect> rects;
for (SkRegion::Iterator it(*native_region); !it.done(); it.next()) {
const SkIRect& rect = it.rect();
SkRect scaled_rect =
SkRect::MakeLTRB(rect.left() * scale, rect.top() * scale,
rect.right() * scale, rect.bottom() * scale);
SkIRect rounded_scaled_rect;
scaled_rect.roundOut(&rounded_scaled_rect);
rects.push_back(rounded_scaled_rect);
}
if (!rects.empty())
device_region.setRects(&rects[0], rects.size());
}
message_handler_->SetRegion(gfx::CreateHRGNFromSkRegion(*shape));
} else {
message_handler_->SetRegion(NULL);
}
......
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