OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/widget/widget_win.h" | 5 #include "views/widget/widget_win.h" |
6 | 6 |
7 #include "app/l10n_util_win.h" | 7 #include "app/l10n_util_win.h" |
8 #include "app/system_monitor.h" | 8 #include "app/system_monitor.h" |
9 #include "app/win_util.h" | 9 #include "app/win_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/win_util.h" | 11 #include "base/win_util.h" |
12 #include "gfx/canvas.h" | 12 #include "gfx/canvas.h" |
| 13 #include "gfx/canvas_skia.h" |
13 #include "gfx/native_theme_win.h" | 14 #include "gfx/native_theme_win.h" |
14 #include "gfx/path.h" | 15 #include "gfx/path.h" |
15 #include "views/accessibility/view_accessibility.h" | 16 #include "views/accessibility/view_accessibility.h" |
16 #include "views/controls/native_control_win.h" | 17 #include "views/controls/native_control_win.h" |
17 #include "views/focus/focus_util_win.h" | 18 #include "views/focus/focus_util_win.h" |
18 #include "views/views_delegate.h" | 19 #include "views/views_delegate.h" |
19 #include "views/widget/aero_tooltip_manager.h" | 20 #include "views/widget/aero_tooltip_manager.h" |
20 #include "views/widget/default_theme_provider.h" | 21 #include "views/widget/default_theme_provider.h" |
21 #include "views/widget/drop_target_win.h" | 22 #include "views/widget/drop_target_win.h" |
22 #include "views/widget/root_view.h" | 23 #include "views/widget/root_view.h" |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 WidgetWin* widget = | 1115 WidgetWin* widget = |
1115 reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(parent)); | 1116 reinterpret_cast<WidgetWin*>(win_util::GetWindowUserData(parent)); |
1116 if (widget && widget->is_window_) | 1117 if (widget && widget->is_window_) |
1117 return static_cast<WindowWin*>(widget); | 1118 return static_cast<WindowWin*>(widget); |
1118 parent = ::GetParent(parent); | 1119 parent = ::GetParent(parent); |
1119 } | 1120 } |
1120 return NULL; | 1121 return NULL; |
1121 } | 1122 } |
1122 | 1123 |
1123 void WidgetWin::SizeContents(const gfx::Size& window_size) { | 1124 void WidgetWin::SizeContents(const gfx::Size& window_size) { |
1124 contents_.reset(new gfx::Canvas(window_size.width(), | 1125 contents_.reset(new gfx::CanvasSkia(window_size.width(), |
1125 window_size.height(), | 1126 window_size.height(), |
1126 false)); | 1127 false)); |
1127 } | 1128 } |
1128 | 1129 |
1129 void WidgetWin::PaintLayeredWindow() { | 1130 void WidgetWin::PaintLayeredWindow() { |
1130 // Painting monkeys with our cliprect, so we need to save it so that the | 1131 // Painting monkeys with our cliprect, so we need to save it so that the |
1131 // call to UpdateLayeredWindow updates the entire window, not just the | 1132 // call to UpdateLayeredWindow updates the entire window, not just the |
1132 // cliprect. | 1133 // cliprect. |
1133 contents_->save(SkCanvas::kClip_SaveFlag); | 1134 contents_->save(SkCanvas::kClip_SaveFlag); |
1134 gfx::Rect dirty_rect = root_view_->GetScheduledPaintRect(); | 1135 gfx::Rect dirty_rect = root_view_->GetScheduledPaintRect(); |
1135 contents_->ClipRectInt(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(), | 1136 contents_->ClipRectInt(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(), |
1136 dirty_rect.height()); | 1137 dirty_rect.height()); |
1137 root_view_->ProcessPaint(contents_.get()); | 1138 root_view_->ProcessPaint(contents_.get()->AsCanvas()); |
1138 contents_->restore(); | 1139 contents_->restore(); |
1139 | 1140 |
1140 UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC()); | 1141 UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC()); |
1141 } | 1142 } |
1142 | 1143 |
1143 void WidgetWin::UpdateWindowFromContents(HDC dib_dc) { | 1144 void WidgetWin::UpdateWindowFromContents(HDC dib_dc) { |
1144 DCHECK(use_layered_buffer_); | 1145 DCHECK(use_layered_buffer_); |
1145 if (can_update_layered_window_) { | 1146 if (can_update_layered_window_) { |
1146 CRect wr; | 1147 CRect wr; |
1147 GetWindowRect(&wr); | 1148 GetWindowRect(&wr); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1367 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
1367 return Widget::GetWidgetFromNativeView(native_window); | 1368 return Widget::GetWidgetFromNativeView(native_window); |
1368 } | 1369 } |
1369 | 1370 |
1370 // static | 1371 // static |
1371 void Widget::NotifyLocaleChanged() { | 1372 void Widget::NotifyLocaleChanged() { |
1372 NOTIMPLEMENTED(); | 1373 NOTIMPLEMENTED(); |
1373 } | 1374 } |
1374 | 1375 |
1375 } // namespace views | 1376 } // namespace views |
OLD | NEW |