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

Unified Diff: webrtc/modules/desktop_capture/desktop_frame_generator.cc

Issue 2334853002: Use RgbaColor in DesktopFrameGenerator and add RgbaColorTest (Closed)
Patch Set: Resolve review comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/BUILD.gn ('k') | webrtc/modules/desktop_capture/rgba_color.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/desktop_frame_generator.cc
diff --git a/webrtc/modules/desktop_capture/desktop_frame_generator.cc b/webrtc/modules/desktop_capture/desktop_frame_generator.cc
index ae5c9492cb92f5806846668cb9a92559cb637a20..608c8407d890fc4fc35f0bb0e1626cdb15d8420d 100644
--- a/webrtc/modules/desktop_capture/desktop_frame_generator.cc
+++ b/webrtc/modules/desktop_capture/desktop_frame_generator.cc
@@ -17,6 +17,7 @@
#include "webrtc/base/random.h"
#include "webrtc/base/timeutils.h"
+#include "webrtc/modules/desktop_capture/rgba_color.h"
namespace webrtc {
@@ -60,11 +61,12 @@ void SetUpdatedRegion(DesktopFrame* frame,
}
// Paints pixels in |rect| of |frame| to |color|.
-void PaintRect(DesktopFrame* frame, DesktopRect rect, uint32_t color) {
+void PaintRect(DesktopFrame* frame, DesktopRect rect, RgbaColor rgba_color) {
static_assert(DesktopFrame::kBytesPerPixel == sizeof(uint32_t),
"kBytesPerPixel should be 4.");
RTC_DCHECK(frame->size().width() >= rect.right() &&
frame->size().height() >= rect.bottom());
+ uint32_t color = rgba_color.ToUInt32();
uint8_t* row = frame->GetFrameDataAtPos(rect.top_left());
for (int i = 0; i < rect.height(); i++) {
uint32_t* column = reinterpret_cast<uint32_t*>(row);
@@ -76,10 +78,12 @@ void PaintRect(DesktopFrame* frame, DesktopRect rect, uint32_t color) {
}
// Paints pixels in |region| of |frame| to |color|.
-void PaintRegion(DesktopFrame* frame, DesktopRegion* region, uint32_t color) {
+void PaintRegion(DesktopFrame* frame,
+ DesktopRegion* region,
+ RgbaColor rgba_color) {
region->IntersectWith(DesktopRect::MakeSize(frame->size()));
for (DesktopRegion::Iterator it(*region); !it.IsAtEnd(); it.Advance()) {
- PaintRect(frame, it.rect(), color);
+ PaintRect(frame, it.rect(), rgba_color);
}
}
@@ -171,7 +175,7 @@ bool BlackWhiteDesktopFramePainter::Paint(DesktopFrame* frame,
DesktopRegion* updated_region) {
RTC_DCHECK(updated_region->is_empty());
memset(frame->data(), 0, frame->stride() * frame->size().height());
- PaintRegion(frame, &updated_region_, UINT32_MAX);
+ PaintRegion(frame, &updated_region_, RgbaColor(0xFFFFFFFF));
updated_region_.Swap(updated_region);
return true;
}
« no previous file with comments | « webrtc/modules/BUILD.gn ('k') | webrtc/modules/desktop_capture/rgba_color.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698