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/surface/accelerated_surface_win.h" | 5 #include "ui/surface/accelerated_surface_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 present_size_ = size; | 768 present_size_ = size; |
769 | 769 |
770 // If it is expected that Direct3D cannot be used reliably because the window | 770 // If it is expected that Direct3D cannot be used reliably because the window |
771 // is resizing, fall back to presenting with GDI. | 771 // is resizing, fall back to presenting with GDI. |
772 if (CheckDirect3DWillWork()) { | 772 if (CheckDirect3DWillWork()) { |
773 TRACE_EVENT0("gpu", "PresentD3D"); | 773 TRACE_EVENT0("gpu", "PresentD3D"); |
774 | 774 |
775 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); | 775 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); |
776 | 776 |
777 // For latency_tests.cc: | 777 // For latency_tests.cc: |
778 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); | 778 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete", |
| 779 TRACE_EVENT_SCOPE_THREAD); |
779 | 780 |
780 if (FAILED(hr)) { | 781 if (FAILED(hr)) { |
781 if (present_thread_->IsDeviceLost()) | 782 if (present_thread_->IsDeviceLost()) |
782 present_thread_->ResetDevice(); | 783 present_thread_->ResetDevice(); |
783 return; | 784 return; |
784 } | 785 } |
785 } else { | 786 } else { |
786 HDC dc = GetDC(window_); | 787 HDC dc = GetDC(window_); |
787 PresentWithGDI(dc); | 788 PresentWithGDI(dc); |
788 ReleaseDC(window_, dc); | 789 ReleaseDC(window_, dc); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 present_size_.height(), | 948 present_size_.height(), |
948 locked_surface.pBits, | 949 locked_surface.pBits, |
949 &bitmap_info, | 950 &bitmap_info, |
950 DIB_RGB_COLORS, | 951 DIB_RGB_COLORS, |
951 SRCCOPY); | 952 SRCCOPY); |
952 } | 953 } |
953 | 954 |
954 system_surface->UnlockRect(); | 955 system_surface->UnlockRect(); |
955 | 956 |
956 // For latency_tests.cc: | 957 // For latency_tests.cc: |
957 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); | 958 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete", |
| 959 TRACE_EVENT_SCOPE_THREAD); |
958 } | 960 } |
959 | 961 |
960 gfx::Size AcceleratedPresenter::GetWindowSize() { | 962 gfx::Size AcceleratedPresenter::GetWindowSize() { |
961 RECT rect; | 963 RECT rect; |
962 GetClientRect(window_, &rect); | 964 GetClientRect(window_, &rect); |
963 return gfx::Rect(rect).size(); | 965 return gfx::Rect(rect).size(); |
964 } | 966 } |
965 | 967 |
966 bool AcceleratedPresenter::CheckDirect3DWillWork() { | 968 bool AcceleratedPresenter::CheckDirect3DWillWork() { |
967 // On a composited desktop, when the screen saver or logon screen are | 969 // On a composited desktop, when the screen saver or logon screen are |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 presenter_->Suspend(); | 1029 presenter_->Suspend(); |
1028 } | 1030 } |
1029 | 1031 |
1030 void AcceleratedSurface::WasHidden() { | 1032 void AcceleratedSurface::WasHidden() { |
1031 presenter_->WasHidden(); | 1033 presenter_->WasHidden(); |
1032 } | 1034 } |
1033 | 1035 |
1034 void AcceleratedSurface::SetIsSessionLocked(bool locked) { | 1036 void AcceleratedSurface::SetIsSessionLocked(bool locked) { |
1035 presenter_->SetIsSessionLocked(locked); | 1037 presenter_->SetIsSessionLocked(locked); |
1036 } | 1038 } |
OLD | NEW |