Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: webrtc/modules/desktop_capture/desktop_frame_win.cc

Issue 1216353002: Fix some clang warnings with -Wmissing-braces in WebRTC. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc/trunk/webrtc.git@master
Patch Set: Fix paths, maybe Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/win32.h ('k') | webrtc/system_wrappers/source/clock.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 DeleteObject(bitmap_); 28 DeleteObject(bitmap_);
29 } 29 }
30 30
31 // static 31 // static
32 DesktopFrameWin* DesktopFrameWin::Create(DesktopSize size, 32 DesktopFrameWin* DesktopFrameWin::Create(DesktopSize size,
33 SharedMemory* shared_memory, 33 SharedMemory* shared_memory,
34 HDC hdc) { 34 HDC hdc) {
35 int bytes_per_row = size.width() * kBytesPerPixel; 35 int bytes_per_row = size.width() * kBytesPerPixel;
36 36
37 // Describe a device independent bitmap (DIB) that is the size of the desktop. 37 // Describe a device independent bitmap (DIB) that is the size of the desktop.
38 BITMAPINFO bmi = {0}; 38 BITMAPINFO bmi = {};
39 bmi.bmiHeader.biHeight = -size.height(); 39 bmi.bmiHeader.biHeight = -size.height();
40 bmi.bmiHeader.biWidth = size.width(); 40 bmi.bmiHeader.biWidth = size.width();
41 bmi.bmiHeader.biPlanes = 1; 41 bmi.bmiHeader.biPlanes = 1;
42 bmi.bmiHeader.biBitCount = DesktopFrameWin::kBytesPerPixel * 8; 42 bmi.bmiHeader.biBitCount = DesktopFrameWin::kBytesPerPixel * 8;
43 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); 43 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
44 bmi.bmiHeader.biSizeImage = bytes_per_row * size.height(); 44 bmi.bmiHeader.biSizeImage = bytes_per_row * size.height();
45 45
46 HANDLE section_handle = NULL; 46 HANDLE section_handle = NULL;
47 if (shared_memory) 47 if (shared_memory)
48 section_handle = shared_memory->handle(); 48 section_handle = shared_memory->handle();
49 void* data = NULL; 49 void* data = NULL;
50 HBITMAP bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &data, 50 HBITMAP bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &data,
51 section_handle, 0); 51 section_handle, 0);
52 if (!bitmap) { 52 if (!bitmap) {
53 LOG(LS_WARNING) << "Failed to allocate new window frame " << GetLastError(); 53 LOG(LS_WARNING) << "Failed to allocate new window frame " << GetLastError();
54 delete shared_memory; 54 delete shared_memory;
55 return NULL; 55 return NULL;
56 } 56 }
57 57
58 return new DesktopFrameWin(size, bytes_per_row, 58 return new DesktopFrameWin(size, bytes_per_row,
59 reinterpret_cast<uint8_t*>(data), 59 reinterpret_cast<uint8_t*>(data),
60 shared_memory, bitmap); 60 shared_memory, bitmap);
61 } 61 }
62 62
63 } // namespace webrtc 63 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/base/win32.h ('k') | webrtc/system_wrappers/source/clock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698