| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "gpu/ipc/service/direct_composition_surface_win.h" | 5 #include "gpu/ipc/service/direct_composition_surface_win.h" |
| 6 #include "base/memory/ref_counted_memory.h" | 6 #include "base/memory/ref_counted_memory.h" |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 std::vector<char> image_data(size.width() * size.height() * 3 / 2); | 115 std::vector<char> image_data(size.width() * size.height() * 3 / 2); |
| 116 // Y, U, and V should all be Oxff. Output color should be pink. | 116 // Y, U, and V should all be Oxff. Output color should be pink. |
| 117 memset(&image_data[0], 0xff, size.width() * size.height() * 3 / 2); | 117 memset(&image_data[0], 0xff, size.width() * size.height() * 3 / 2); |
| 118 | 118 |
| 119 D3D11_SUBRESOURCE_DATA data = {}; | 119 D3D11_SUBRESOURCE_DATA data = {}; |
| 120 data.pSysMem = (const void*)&image_data[0]; | 120 data.pSysMem = (const void*)&image_data[0]; |
| 121 data.SysMemPitch = size.width(); | 121 data.SysMemPitch = size.width(); |
| 122 | 122 |
| 123 base::win::ScopedComPtr<ID3D11Texture2D> texture; | 123 base::win::ScopedComPtr<ID3D11Texture2D> texture; |
| 124 HRESULT hr = d3d11_device->CreateTexture2D(&desc, &data, texture.Receive()); | 124 HRESULT hr = |
| 125 d3d11_device->CreateTexture2D(&desc, &data, texture.GetAddressOf()); |
| 125 CHECK(SUCCEEDED(hr)); | 126 CHECK(SUCCEEDED(hr)); |
| 126 return texture; | 127 return texture; |
| 127 } | 128 } |
| 128 | 129 |
| 129 TEST(DirectCompositionSurfaceTest, TestMakeCurrent) { | 130 TEST(DirectCompositionSurfaceTest, TestMakeCurrent) { |
| 130 if (!CheckIfDCSupported()) | 131 if (!CheckIfDCSupported()) |
| 131 return; | 132 return; |
| 132 | 133 |
| 133 TestImageTransportSurfaceDelegate delegate; | 134 TestImageTransportSurfaceDelegate delegate; |
| 134 | 135 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); | 556 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); |
| 556 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) | 557 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) |
| 557 << std::hex << "Expected " << expected_color << " Actual " | 558 << std::hex << "Expected " << expected_color << " Actual " |
| 558 << actual_color; | 559 << actual_color; |
| 559 | 560 |
| 560 context = nullptr; | 561 context = nullptr; |
| 561 DestroySurface(std::move(surface_)); | 562 DestroySurface(std::move(surface_)); |
| 562 } | 563 } |
| 563 } // namespace | 564 } // namespace |
| 564 } // namespace gpu | 565 } // namespace gpu |
| OLD | NEW |