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 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 VideoRenderer* local_renderer = local_renderer_.get(); | 227 VideoRenderer* local_renderer = local_renderer_.get(); |
228 VideoRenderer* remote_renderer = remote_renderer_.get(); | 228 VideoRenderer* remote_renderer = remote_renderer_.get(); |
229 if (ui_ == STREAMING && remote_renderer && local_renderer) { | 229 if (ui_ == STREAMING && remote_renderer && local_renderer) { |
230 AutoLock<VideoRenderer> local_lock(local_renderer); | 230 AutoLock<VideoRenderer> local_lock(local_renderer); |
231 AutoLock<VideoRenderer> remote_lock(remote_renderer); | 231 AutoLock<VideoRenderer> remote_lock(remote_renderer); |
232 | 232 |
233 const BITMAPINFO& bmi = remote_renderer->bmi(); | 233 const BITMAPINFO& bmi = remote_renderer->bmi(); |
234 int height = abs(bmi.bmiHeader.biHeight); | 234 int height = abs(bmi.bmiHeader.biHeight); |
235 int width = bmi.bmiHeader.biWidth; | 235 int width = bmi.bmiHeader.biWidth; |
236 | 236 |
237 const uint8* image = remote_renderer->image(); | 237 const uint8_t* image = remote_renderer->image(); |
238 if (image != NULL) { | 238 if (image != NULL) { |
239 HDC dc_mem = ::CreateCompatibleDC(ps.hdc); | 239 HDC dc_mem = ::CreateCompatibleDC(ps.hdc); |
240 ::SetStretchBltMode(dc_mem, HALFTONE); | 240 ::SetStretchBltMode(dc_mem, HALFTONE); |
241 | 241 |
242 // Set the map mode so that the ratio will be maintained for us. | 242 // Set the map mode so that the ratio will be maintained for us. |
243 HDC all_dc[] = { ps.hdc, dc_mem }; | 243 HDC all_dc[] = { ps.hdc, dc_mem }; |
244 for (int i = 0; i < ARRAY_SIZE(all_dc); ++i) { | 244 for (int i = 0; i < ARRAY_SIZE(all_dc); ++i) { |
245 SetMapMode(all_dc[i], MM_ISOTROPIC); | 245 SetMapMode(all_dc[i], MM_ISOTROPIC); |
246 SetWindowExtEx(all_dc[i], width, height, NULL); | 246 SetWindowExtEx(all_dc[i], width, height, NULL); |
247 SetViewportExtEx(all_dc[i], rc.right, rc.bottom, NULL); | 247 SetViewportExtEx(all_dc[i], rc.right, rc.bottom, NULL); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 AutoLock<VideoRenderer> lock(this); | 587 AutoLock<VideoRenderer> lock(this); |
588 | 588 |
589 if (width == bmi_.bmiHeader.biWidth && height == bmi_.bmiHeader.biHeight) { | 589 if (width == bmi_.bmiHeader.biWidth && height == bmi_.bmiHeader.biHeight) { |
590 return; | 590 return; |
591 } | 591 } |
592 | 592 |
593 bmi_.bmiHeader.biWidth = width; | 593 bmi_.bmiHeader.biWidth = width; |
594 bmi_.bmiHeader.biHeight = -height; | 594 bmi_.bmiHeader.biHeight = -height; |
595 bmi_.bmiHeader.biSizeImage = width * height * | 595 bmi_.bmiHeader.biSizeImage = width * height * |
596 (bmi_.bmiHeader.biBitCount >> 3); | 596 (bmi_.bmiHeader.biBitCount >> 3); |
597 image_.reset(new uint8[bmi_.bmiHeader.biSizeImage]); | 597 image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]); |
598 } | 598 } |
599 | 599 |
600 void MainWnd::VideoRenderer::RenderFrame( | 600 void MainWnd::VideoRenderer::RenderFrame( |
601 const cricket::VideoFrame* video_frame) { | 601 const cricket::VideoFrame* video_frame) { |
602 if (!video_frame) | 602 if (!video_frame) |
603 return; | 603 return; |
604 | 604 |
605 { | 605 { |
606 AutoLock<VideoRenderer> lock(this); | 606 AutoLock<VideoRenderer> lock(this); |
607 | 607 |
608 const cricket::VideoFrame* frame = | 608 const cricket::VideoFrame* frame = |
609 video_frame->GetCopyWithRotationApplied(); | 609 video_frame->GetCopyWithRotationApplied(); |
610 | 610 |
611 SetSize(static_cast<int>(frame->GetWidth()), | 611 SetSize(static_cast<int>(frame->GetWidth()), |
612 static_cast<int>(frame->GetHeight())); | 612 static_cast<int>(frame->GetHeight())); |
613 | 613 |
614 ASSERT(image_.get() != NULL); | 614 ASSERT(image_.get() != NULL); |
615 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, | 615 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, |
616 image_.get(), | 616 image_.get(), |
617 bmi_.bmiHeader.biSizeImage, | 617 bmi_.bmiHeader.biSizeImage, |
618 bmi_.bmiHeader.biWidth * | 618 bmi_.bmiHeader.biWidth * |
619 bmi_.bmiHeader.biBitCount / 8); | 619 bmi_.bmiHeader.biBitCount / 8); |
620 } | 620 } |
621 InvalidateRect(wnd_, NULL, TRUE); | 621 InvalidateRect(wnd_, NULL, TRUE); |
622 } | 622 } |
OLD | NEW |