OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const int right, | 54 const int right, |
55 const int top, | 55 const int top, |
56 const int bottom, | 56 const int bottom, |
57 const int stride, | 57 const int stride, |
58 DesktopRegion* const output) { | 58 DesktopRegion* const output) { |
59 const int block_x_offset = kBlockSize * DesktopFrame::kBytesPerPixel; | 59 const int block_x_offset = kBlockSize * DesktopFrame::kBytesPerPixel; |
60 const int width = right - left; | 60 const int width = right - left; |
61 const int height = bottom - top; | 61 const int height = bottom - top; |
62 const int block_count = (width - 1) / kBlockSize; | 62 const int block_count = (width - 1) / kBlockSize; |
63 const int last_block_width = width - block_count * kBlockSize; | 63 const int last_block_width = width - block_count * kBlockSize; |
64 RTC_DCHECK(last_block_width <= kBlockSize && last_block_width > 0); | 64 RTC_DCHECK_GT(last_block_width, 0); |
| 65 RTC_DCHECK_LE(last_block_width, kBlockSize); |
65 | 66 |
66 // The first block-column in a continuous dirty area in current block-row. | 67 // The first block-column in a continuous dirty area in current block-row. |
67 int first_dirty_x_block = -1; | 68 int first_dirty_x_block = -1; |
68 | 69 |
69 // We always need to add dirty area into |output| in the last block, so handle | 70 // We always need to add dirty area into |output| in the last block, so handle |
70 // it separatedly. | 71 // it separatedly. |
71 for (int x = 0; x < block_count; x++) { | 72 for (int x = 0; x < block_count; x++) { |
72 if (BlockDifference(old_buffer, new_buffer, height, stride)) { | 73 if (BlockDifference(old_buffer, new_buffer, height, stride)) { |
73 if (first_dirty_x_block == -1) { | 74 if (first_dirty_x_block == -1) { |
74 // This is the first dirty block in a continuous dirty area. | 75 // This is the first dirty block in a continuous dirty area. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 last_frame_ = frame->Share(); | 213 last_frame_ = frame->Share(); |
213 | 214 |
214 frame->set_capture_time_ms(frame->GetUnderlyingFrame()->capture_time_ms() + | 215 frame->set_capture_time_ms(frame->GetUnderlyingFrame()->capture_time_ms() + |
215 (rtc::TimeNanos() - start_time_nanos) / | 216 (rtc::TimeNanos() - start_time_nanos) / |
216 rtc::kNumNanosecsPerMillisec); | 217 rtc::kNumNanosecsPerMillisec); |
217 frame->set_capturer_id(frame->GetUnderlyingFrame()->capturer_id()); | 218 frame->set_capturer_id(frame->GetUnderlyingFrame()->capturer_id()); |
218 callback_->OnCaptureResult(result, std::move(frame)); | 219 callback_->OnCaptureResult(result, std::move(frame)); |
219 } | 220 } |
220 | 221 |
221 } // namespace webrtc | 222 } // namespace webrtc |
OLD | NEW |