OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); | 1070 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); |
1071 } | 1071 } |
1072 } | 1072 } |
1073 } | 1073 } |
1074 | 1074 |
1075 void WidgetWin::RedrawLayeredWindowContents() { | 1075 void WidgetWin::RedrawLayeredWindowContents() { |
1076 if (layered_window_invalid_rect_.IsEmpty()) | 1076 if (layered_window_invalid_rect_.IsEmpty()) |
1077 return; | 1077 return; |
1078 | 1078 |
1079 // We need to clip to the dirty rect ourselves. | 1079 // We need to clip to the dirty rect ourselves. |
1080 layered_window_contents_->save(SkCanvas::kClip_SaveFlag); | 1080 layered_window_contents_->skia_canvas()->save(SkCanvas::kClip_SaveFlag); |
1081 layered_window_contents_->ClipRectInt(layered_window_invalid_rect_.x(), | 1081 layered_window_contents_->ClipRectInt(layered_window_invalid_rect_.x(), |
1082 layered_window_invalid_rect_.y(), | 1082 layered_window_invalid_rect_.y(), |
1083 layered_window_invalid_rect_.width(), | 1083 layered_window_invalid_rect_.width(), |
1084 layered_window_invalid_rect_.height()); | 1084 layered_window_invalid_rect_.height()); |
1085 GetRootView()->Paint(layered_window_contents_.get()); | 1085 GetRootView()->Paint(layered_window_contents_.get()); |
1086 layered_window_contents_->restore(); | 1086 layered_window_contents_->skia_canvas()->restore(); |
1087 | 1087 |
1088 RECT wr; | 1088 RECT wr; |
1089 GetWindowRect(&wr); | 1089 GetWindowRect(&wr); |
1090 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; | 1090 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; |
1091 POINT position = {wr.left, wr.top}; | 1091 POINT position = {wr.left, wr.top}; |
1092 HDC dib_dc = layered_window_contents_->beginPlatformPaint(); | 1092 HDC dib_dc = layered_window_contents_->BeginPlatformPaint(); |
1093 POINT zero = {0, 0}; | 1093 POINT zero = {0, 0}; |
1094 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; | 1094 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; |
1095 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, | 1095 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, |
1096 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); | 1096 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); |
1097 layered_window_invalid_rect_.SetRect(0, 0, 0, 0); | 1097 layered_window_invalid_rect_.SetRect(0, 0, 0, 0); |
1098 layered_window_contents_->endPlatformPaint(); | 1098 layered_window_contents_->EndPlatformPaint(); |
1099 } | 1099 } |
1100 | 1100 |
1101 void WidgetWin::ClientAreaSizeChanged() { | 1101 void WidgetWin::ClientAreaSizeChanged() { |
1102 RECT r; | 1102 RECT r; |
1103 GetClientRect(&r); | 1103 GetClientRect(&r); |
1104 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), | 1104 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)), |
1105 std::max(0, static_cast<int>(r.bottom - r.top))); | 1105 std::max(0, static_cast<int>(r.bottom - r.top))); |
1106 delegate_->OnSizeChanged(s); | 1106 delegate_->OnSizeChanged(s); |
1107 if (use_layered_buffer_) { | 1107 if (use_layered_buffer_) { |
1108 layered_window_contents_.reset( | 1108 layered_window_contents_.reset(new gfx::CanvasSkia); |
1109 new gfx::CanvasSkia(s.width(), s.height(), false)); | 1109 layered_window_contents_->Init(s.width(), s.height(), false); |
1110 } | 1110 } |
1111 } | 1111 } |
1112 | 1112 |
1113 gfx::AcceleratedWidget WidgetWin::GetAcceleratedWidget() { | 1113 gfx::AcceleratedWidget WidgetWin::GetAcceleratedWidget() { |
1114 // TODO(beng): | 1114 // TODO(beng): |
1115 return gfx::kNullAcceleratedWidget; | 1115 return gfx::kNullAcceleratedWidget; |
1116 } | 1116 } |
1117 | 1117 |
1118 void WidgetWin::DispatchKeyEventPostIME(const KeyEvent& key) { | 1118 void WidgetWin::DispatchKeyEventPostIME(const KeyEvent& key) { |
1119 RootView* root_view = GetFocusedViewRootView(); | 1119 RootView* root_view = GetFocusedViewRootView(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 | 1240 |
1241 // And now, notify them that they have a brand new parent. | 1241 // And now, notify them that they have a brand new parent. |
1242 for (NativeWidgets::iterator it = widgets.begin(); | 1242 for (NativeWidgets::iterator it = widgets.begin(); |
1243 it != widgets.end(); ++it) { | 1243 it != widgets.end(); ++it) { |
1244 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, | 1244 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, |
1245 new_parent); | 1245 new_parent); |
1246 } | 1246 } |
1247 } | 1247 } |
1248 | 1248 |
1249 } // namespace views | 1249 } // namespace views |
OLD | NEW |