OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
6 | 6 |
7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork); | 279 gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork); |
280 return gfx::win::ScreenToDIPRect(pixel_bounds); | 280 return gfx::win::ScreenToDIPRect(pixel_bounds); |
281 } | 281 } |
282 | 282 |
283 void DesktopWindowTreeHostWin::SetShape(gfx::NativeRegion native_region) { | 283 void DesktopWindowTreeHostWin::SetShape(gfx::NativeRegion native_region) { |
284 if (native_region) { | 284 if (native_region) { |
285 // TODO(wez): This would be a lot simpler if we were passed an SkPath. | 285 // TODO(wez): This would be a lot simpler if we were passed an SkPath. |
286 // See crbug.com/410593. | 286 // See crbug.com/410593. |
287 gfx::NativeRegion shape = native_region; | 287 gfx::NativeRegion shape = native_region; |
288 SkRegion device_region; | 288 SkRegion device_region; |
289 if (gfx::IsInHighDPIMode()) { | 289 if (gfx::GetDPIScale() > 1.0) { |
290 shape = &device_region; | 290 shape = &device_region; |
291 const float& scale = gfx::GetDPIScale(); | 291 const float& scale = gfx::GetDPIScale(); |
292 std::vector<SkIRect> rects; | 292 std::vector<SkIRect> rects; |
293 for (SkRegion::Iterator it(*native_region); !it.done(); it.next()) { | 293 for (SkRegion::Iterator it(*native_region); !it.done(); it.next()) { |
294 const SkIRect& rect = it.rect(); | 294 const SkIRect& rect = it.rect(); |
295 SkRect scaled_rect = | 295 SkRect scaled_rect = |
296 SkRect::MakeLTRB(rect.left() * scale, rect.top() * scale, | 296 SkRect::MakeLTRB(rect.left() * scale, rect.top() * scale, |
297 rect.right() * scale, rect.bottom() * scale); | 297 rect.right() * scale, rect.bottom() * scale); |
298 SkIRect rounded_scaled_rect; | 298 SkIRect rounded_scaled_rect; |
299 scaled_rect.roundOut(&rounded_scaled_rect); | 299 scaled_rect.roundOut(&rounded_scaled_rect); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 | 999 |
1000 // static | 1000 // static |
1001 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 1001 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
1002 internal::NativeWidgetDelegate* native_widget_delegate, | 1002 internal::NativeWidgetDelegate* native_widget_delegate, |
1003 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 1003 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
1004 return new DesktopWindowTreeHostWin(native_widget_delegate, | 1004 return new DesktopWindowTreeHostWin(native_widget_delegate, |
1005 desktop_native_widget_aura); | 1005 desktop_native_widget_aura); |
1006 } | 1006 } |
1007 | 1007 |
1008 } // namespace views | 1008 } // namespace views |
OLD | NEW |