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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 RedrawWindow(hwnd(), &update_rect.ToRECT(), NULL, | 377 RedrawWindow(hwnd(), &update_rect.ToRECT(), NULL, |
378 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); | 378 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); |
379 | 379 |
380 LPARAM lparam = reinterpret_cast<LPARAM>(&invalid_screen_rect); | 380 LPARAM lparam = reinterpret_cast<LPARAM>(&invalid_screen_rect); |
381 EnumChildWindows(hwnd(), EnumChildProcForRedraw, lparam); | 381 EnumChildWindows(hwnd(), EnumChildProcForRedraw, lparam); |
382 } | 382 } |
383 // As we were created with a style of WS_CLIPCHILDREN redraw requests may | 383 // As we were created with a style of WS_CLIPCHILDREN redraw requests may |
384 // result in an empty paint rect in WM_PAINT (this'll happen if a | 384 // result in an empty paint rect in WM_PAINT (this'll happen if a |
385 // child HWND completely contains the update _rect). In such a scenario | 385 // child HWND completely contains the update _rect). In such a scenario |
386 // RootView would never get a ProcessPaint and always think it needs to | 386 // RootView would never get a Paint() and always think it needs to be |
387 // be painted (leading to a steady stream of RedrawWindow requests on every | 387 // painted (leading to a steady stream of RedrawWindow requests on every |
388 // event). For this reason we tell RootView it doesn't need to paint | 388 // event). For this reason we tell RootView it doesn't need to paint |
389 // here. | 389 // here. |
390 root_view_->ClearPaintRect(); | 390 root_view_->ClearPaintRect(); |
391 } | 391 } |
392 } | 392 } |
393 | 393 |
394 void WidgetWin::SetOpacity(unsigned char opacity) { | 394 void WidgetWin::SetOpacity(unsigned char opacity) { |
395 layered_alpha_ = static_cast<BYTE>(opacity); | 395 layered_alpha_ = static_cast<BYTE>(opacity); |
396 } | 396 } |
397 | 397 |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 } | 1151 } |
1152 | 1152 |
1153 void WidgetWin::PaintLayeredWindow() { | 1153 void WidgetWin::PaintLayeredWindow() { |
1154 // Painting monkeys with our cliprect, so we need to save it so that the | 1154 // Painting monkeys with our cliprect, so we need to save it so that the |
1155 // call to UpdateLayeredWindow updates the entire window, not just the | 1155 // call to UpdateLayeredWindow updates the entire window, not just the |
1156 // cliprect. | 1156 // cliprect. |
1157 contents_->save(SkCanvas::kClip_SaveFlag); | 1157 contents_->save(SkCanvas::kClip_SaveFlag); |
1158 gfx::Rect dirty_rect = root_view_->GetScheduledPaintRect(); | 1158 gfx::Rect dirty_rect = root_view_->GetScheduledPaintRect(); |
1159 contents_->ClipRectInt(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(), | 1159 contents_->ClipRectInt(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(), |
1160 dirty_rect.height()); | 1160 dirty_rect.height()); |
1161 root_view_->ProcessPaint(contents_.get()); | 1161 root_view_->Paint(contents_.get()); |
1162 contents_->restore(); | 1162 contents_->restore(); |
1163 | 1163 |
1164 UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC()); | 1164 UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC()); |
1165 } | 1165 } |
1166 | 1166 |
1167 void WidgetWin::UpdateWindowFromContents(HDC dib_dc) { | 1167 void WidgetWin::UpdateWindowFromContents(HDC dib_dc) { |
1168 DCHECK(use_layered_buffer_); | 1168 DCHECK(use_layered_buffer_); |
1169 if (can_update_layered_window_) { | 1169 if (can_update_layered_window_) { |
1170 CRect wr; | 1170 CRect wr; |
1171 GetWindowRect(&wr); | 1171 GetWindowRect(&wr); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { | 1396 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { |
1397 return Widget::GetWidgetFromNativeView(native_window); | 1397 return Widget::GetWidgetFromNativeView(native_window); |
1398 } | 1398 } |
1399 | 1399 |
1400 // static | 1400 // static |
1401 void Widget::NotifyLocaleChanged() { | 1401 void Widget::NotifyLocaleChanged() { |
1402 NOTIMPLEMENTED(); | 1402 NOTIMPLEMENTED(); |
1403 } | 1403 } |
1404 | 1404 |
1405 } // namespace views | 1405 } // namespace views |
OLD | NEW |