Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc

Issue 532913003: Account for device scale factor in AppWindow.setShape(), under Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
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 877e8d1ccb3e30491c326022d939acfcb466e75c..6659feac72a78585e8b57e13531fd9dcdb8d1523 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
@@ -280,7 +280,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;
sky 2014/09/04 18:00:56 Does Skia not have a way to scale a SkRegion? Seem
Wez 2014/09/04 18:19:08 Sadly no. :( My guess is that you're really inten
+ 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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698