Index: webrtc/modules/desktop_capture/desktop_geometry.cc |
diff --git a/webrtc/modules/desktop_capture/desktop_geometry.cc b/webrtc/modules/desktop_capture/desktop_geometry.cc |
index 1ff7c683c79828a0d8c4e5f9c4c4cb23fd365243..0881c6f0175eb50798f0958630a8c657bcd36592 100644 |
--- a/webrtc/modules/desktop_capture/desktop_geometry.cc |
+++ b/webrtc/modules/desktop_capture/desktop_geometry.cc |
@@ -44,5 +44,18 @@ void DesktopRect::Translate(int32_t dx, int32_t dy) { |
bottom_ += dy; |
} |
+DesktopRect DesktopRect::Expand(uint32_t padding, |
+ const DesktopSize& size) const { |
+ int32_t l = left() - padding; |
+ int32_t t = top() - padding; |
+ int32_t r = right() + padding; |
+ int32_t b = bottom() + padding; |
+ if (l < 0) l = 0; |
+ if (t < 0) t = 0; |
+ if (r > size.width()) r = size.width(); |
+ if (b > size.height()) b = size.height(); |
+ return DesktopRect(l, t, r, b); |
+} |
+ |
} // namespace webrtc |