| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 bmi.bmiHeader.biPlanes = 1; | 44 bmi.bmiHeader.biPlanes = 1; |
| 45 bmi.bmiHeader.biBitCount = DesktopFrameWin::kBytesPerPixel * 8; | 45 bmi.bmiHeader.biBitCount = DesktopFrameWin::kBytesPerPixel * 8; |
| 46 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); | 46 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); |
| 47 bmi.bmiHeader.biSizeImage = bytes_per_row * size.height(); | 47 bmi.bmiHeader.biSizeImage = bytes_per_row * size.height(); |
| 48 | 48 |
| 49 std::unique_ptr<SharedMemory> shared_memory; | 49 std::unique_ptr<SharedMemory> shared_memory; |
| 50 HANDLE section_handle = nullptr; | 50 HANDLE section_handle = nullptr; |
| 51 if (shared_memory_factory) { | 51 if (shared_memory_factory) { |
| 52 shared_memory = rtc::ScopedToUnique( | 52 shared_memory = rtc::ScopedToUnique( |
| 53 shared_memory_factory->CreateSharedMemory(buffer_size)); | 53 shared_memory_factory->CreateSharedMemory(buffer_size)); |
| 54 if (shared_memory) | 54 section_handle = shared_memory->handle(); |
| 55 section_handle = shared_memory->handle(); | |
| 56 } | 55 } |
| 57 void* data = nullptr; | 56 void* data = nullptr; |
| 58 HBITMAP bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &data, | 57 HBITMAP bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &data, |
| 59 section_handle, 0); | 58 section_handle, 0); |
| 60 if (!bitmap) { | 59 if (!bitmap) { |
| 61 LOG(LS_WARNING) << "Failed to allocate new window frame " << GetLastError(); | 60 LOG(LS_WARNING) << "Failed to allocate new window frame " << GetLastError(); |
| 62 return nullptr; | 61 return nullptr; |
| 63 } | 62 } |
| 64 | 63 |
| 65 return new DesktopFrameWin(size, bytes_per_row, | 64 return new DesktopFrameWin(size, bytes_per_row, |
| 66 reinterpret_cast<uint8_t*>(data), | 65 reinterpret_cast<uint8_t*>(data), |
| 67 std::move(shared_memory), bitmap); | 66 std::move(shared_memory), bitmap); |
| 68 } | 67 } |
| 69 | 68 |
| 70 } // namespace webrtc | 69 } // namespace webrtc |
| OLD | NEW |