| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 |
| 11 #include "webrtc/examples/peerconnection/client/main_wnd.h" | 11 #include "webrtc/examples/peerconnection/client/main_wnd.h" |
| 12 | 12 |
| 13 #include <math.h> | 13 #include <math.h> |
| 14 | 14 |
| 15 #include "webrtc/examples/peerconnection/client/defaults.h" | 15 #include "webrtc/examples/peerconnection/client/defaults.h" |
| 16 #include "webrtc/base/arraysize.h" |
| 16 #include "webrtc/base/common.h" | 17 #include "webrtc/base/common.h" |
| 17 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" |
| 18 | 19 |
| 19 ATOM MainWnd::wnd_class_ = 0; | 20 ATOM MainWnd::wnd_class_ = 0; |
| 20 const wchar_t MainWnd::kClassName[] = L"WebRTC_MainWnd"; | 21 const wchar_t MainWnd::kClassName[] = L"WebRTC_MainWnd"; |
| 21 | 22 |
| 22 using rtc::sprintfn; | 23 using rtc::sprintfn; |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 int height = abs(bmi.bmiHeader.biHeight); | 235 int height = abs(bmi.bmiHeader.biHeight); |
| 235 int width = bmi.bmiHeader.biWidth; | 236 int width = bmi.bmiHeader.biWidth; |
| 236 | 237 |
| 237 const uint8_t* image = remote_renderer->image(); | 238 const uint8_t* image = remote_renderer->image(); |
| 238 if (image != NULL) { | 239 if (image != NULL) { |
| 239 HDC dc_mem = ::CreateCompatibleDC(ps.hdc); | 240 HDC dc_mem = ::CreateCompatibleDC(ps.hdc); |
| 240 ::SetStretchBltMode(dc_mem, HALFTONE); | 241 ::SetStretchBltMode(dc_mem, HALFTONE); |
| 241 | 242 |
| 242 // Set the map mode so that the ratio will be maintained for us. | 243 // Set the map mode so that the ratio will be maintained for us. |
| 243 HDC all_dc[] = { ps.hdc, dc_mem }; | 244 HDC all_dc[] = { ps.hdc, dc_mem }; |
| 244 for (int i = 0; i < ARRAY_SIZE(all_dc); ++i) { | 245 for (int i = 0; i < arraysize(all_dc); ++i) { |
| 245 SetMapMode(all_dc[i], MM_ISOTROPIC); | 246 SetMapMode(all_dc[i], MM_ISOTROPIC); |
| 246 SetWindowExtEx(all_dc[i], width, height, NULL); | 247 SetWindowExtEx(all_dc[i], width, height, NULL); |
| 247 SetViewportExtEx(all_dc[i], rc.right, rc.bottom, NULL); | 248 SetViewportExtEx(all_dc[i], rc.right, rc.bottom, NULL); |
| 248 } | 249 } |
| 249 | 250 |
| 250 HBITMAP bmp_mem = ::CreateCompatibleBitmap(ps.hdc, rc.right, rc.bottom); | 251 HBITMAP bmp_mem = ::CreateCompatibleBitmap(ps.hdc, rc.right, rc.bottom); |
| 251 HGDIOBJ bmp_old = ::SelectObject(dc_mem, bmp_mem); | 252 HGDIOBJ bmp_old = ::SelectObject(dc_mem, bmp_mem); |
| 252 | 253 |
| 253 POINT logical_area = { rc.right, rc.bottom }; | 254 POINT logical_area = { rc.right, rc.bottom }; |
| 254 DPtoLP(ps.hdc, &logical_area, 1); | 255 DPtoLP(ps.hdc, &logical_area, 1); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 614 |
| 614 ASSERT(image_.get() != NULL); | 615 ASSERT(image_.get() != NULL); |
| 615 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, | 616 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, |
| 616 image_.get(), | 617 image_.get(), |
| 617 bmi_.bmiHeader.biSizeImage, | 618 bmi_.bmiHeader.biSizeImage, |
| 618 bmi_.bmiHeader.biWidth * | 619 bmi_.bmiHeader.biWidth * |
| 619 bmi_.bmiHeader.biBitCount / 8); | 620 bmi_.bmiHeader.biBitCount / 8); |
| 620 } | 621 } |
| 621 InvalidateRect(wnd_, NULL, TRUE); | 622 InvalidateRect(wnd_, NULL, TRUE); |
| 622 } | 623 } |
| OLD | NEW |