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

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

Issue 1902323002: Modify ScreenCaptureFrameQueue into a template (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix build break in linux Created 4 years, 8 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 uint32_t BlendPixels(uint32_t dest, uint32_t src) { 52 uint32_t BlendPixels(uint32_t dest, uint32_t src) {
53 uint8_t alpha = 255 - ((src & 0xff000000) >> 24); 53 uint8_t alpha = 255 - ((src & 0xff000000) >> 24);
54 uint32_t r = 54 uint32_t r =
55 ((dest & 0x00ff0000) >> 16) * alpha / 255 + ((src & 0x00ff0000) >> 16); 55 ((dest & 0x00ff0000) >> 16) * alpha / 255 + ((src & 0x00ff0000) >> 16);
56 uint32_t g = 56 uint32_t g =
57 ((dest & 0x0000ff00) >> 8) * alpha / 255 + ((src & 0x0000ff00) >> 8); 57 ((dest & 0x0000ff00) >> 8) * alpha / 255 + ((src & 0x0000ff00) >> 8);
58 uint32_t b = (dest & 0x000000ff) * alpha / 255 + (src & 0x000000ff); 58 uint32_t b = (dest & 0x000000ff) * alpha / 255 + (src & 0x000000ff);
59 return b + (g << 8) + (r << 16) + 0xff000000; 59 return b + (g << 8) + (r << 16) + 0xff000000;
60 } 60 }
61 61
62 DesktopFrame* CreateTestFrame() { 62 std::unique_ptr<DesktopFrame> CreateTestFrame() {
63 DesktopFrame* frame = 63 std::unique_ptr<DesktopFrame> frame(
64 new BasicDesktopFrame(DesktopSize(kScreenWidth, kScreenHeight)); 64 new BasicDesktopFrame(DesktopSize(kScreenWidth, kScreenHeight)));
65 uint32_t* data = reinterpret_cast<uint32_t*>(frame->data()); 65 uint32_t* data = reinterpret_cast<uint32_t*>(frame->data());
66 for (int y = 0; y < kScreenHeight; ++y) { 66 for (int y = 0; y < kScreenHeight; ++y) {
67 for (int x = 0; x < kScreenWidth; ++x) { 67 for (int x = 0; x < kScreenWidth; ++x) {
68 *(data++) = GetFakeFramePixelValue(DesktopVector(x, y)); 68 *(data++) = GetFakeFramePixelValue(DesktopVector(x, y));
69 } 69 }
70 } 70 }
71 return frame; 71 return frame;
72 } 72 }
73 73
74 class FakeScreenCapturer : public DesktopCapturer { 74 class FakeScreenCapturer : public DesktopCapturer {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Verify that the cursor is erased before the frame buffer is returned to 240 // Verify that the cursor is erased before the frame buffer is returned to
241 // the screen capturer. 241 // the screen capturer.
242 frame_.reset(); 242 frame_.reset();
243 VerifyFrame(*frame, MouseCursorMonitor::OUTSIDE, DesktopVector()); 243 VerifyFrame(*frame, MouseCursorMonitor::OUTSIDE, DesktopVector());
244 } 244 }
245 } 245 }
246 246
247 } // namespace 247 } // namespace
248 248
249 } // namespace webrtc 249 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698