| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 frame->mutable_updated_region()->AddRect( | 57 frame->mutable_updated_region()->AddRect( |
| 58 DesktopRect::MakeLTRB(left, top, right, bottom)); | 58 DesktopRect::MakeLTRB(left, top, right, bottom)); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Paints pixels in |rect| of |frame| to |color|. | 63 // Paints pixels in |rect| of |frame| to |color|. |
| 64 void PaintRect(DesktopFrame* frame, DesktopRect rect, RgbaColor rgba_color) { | 64 void PaintRect(DesktopFrame* frame, DesktopRect rect, RgbaColor rgba_color) { |
| 65 static_assert(DesktopFrame::kBytesPerPixel == sizeof(uint32_t), | 65 static_assert(DesktopFrame::kBytesPerPixel == sizeof(uint32_t), |
| 66 "kBytesPerPixel should be 4."); | 66 "kBytesPerPixel should be 4."); |
| 67 RTC_DCHECK(frame->size().width() >= rect.right() && | 67 RTC_DCHECK_GE(frame->size().width(), rect.right()); |
| 68 frame->size().height() >= rect.bottom()); | 68 RTC_DCHECK_GE(frame->size().height(), rect.bottom()); |
| 69 uint32_t color = rgba_color.ToUInt32(); | 69 uint32_t color = rgba_color.ToUInt32(); |
| 70 uint8_t* row = frame->GetFrameDataAtPos(rect.top_left()); | 70 uint8_t* row = frame->GetFrameDataAtPos(rect.top_left()); |
| 71 for (int i = 0; i < rect.height(); i++) { | 71 for (int i = 0; i < rect.height(); i++) { |
| 72 uint32_t* column = reinterpret_cast<uint32_t*>(row); | 72 uint32_t* column = reinterpret_cast<uint32_t*>(row); |
| 73 for (int j = 0; j < rect.width(); j++) { | 73 for (int j = 0; j < rect.width(); j++) { |
| 74 column[j] = color; | 74 column[j] = color; |
| 75 } | 75 } |
| 76 row += frame->stride(); | 76 row += frame->stride(); |
| 77 } | 77 } |
| 78 } | 78 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 bool BlackWhiteDesktopFramePainter::Paint(DesktopFrame* frame, | 174 bool BlackWhiteDesktopFramePainter::Paint(DesktopFrame* frame, |
| 175 DesktopRegion* updated_region) { | 175 DesktopRegion* updated_region) { |
| 176 RTC_DCHECK(updated_region->is_empty()); | 176 RTC_DCHECK(updated_region->is_empty()); |
| 177 memset(frame->data(), 0, frame->stride() * frame->size().height()); | 177 memset(frame->data(), 0, frame->stride() * frame->size().height()); |
| 178 PaintRegion(frame, &updated_region_, RgbaColor(0xFFFFFFFF)); | 178 PaintRegion(frame, &updated_region_, RgbaColor(0xFFFFFFFF)); |
| 179 updated_region_.Swap(updated_region); | 179 updated_region_.Swap(updated_region); |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace webrtc | 183 } // namespace webrtc |
| OLD | NEW |