Fix bugs in DesktopRegion::IntersectWith() and DesktopRect::IntersectWith().

IntersectWith() didn't work correctly which breaks screen capturers in chromium.

BUG=crbug.com/243160
R=alexeypa@chromium.org, wez@chromium.org

Review URL: https://webrtc-codereview.appspot.com/1560004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4102 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sergeyu@chromium.org 2013-05-24 21:07:20 +00:00
parent 8665da8926
commit ead3c6d508
2 changed files with 3 additions and 2 deletions

View File

@ -18,7 +18,7 @@ void DesktopRect::IntersectWith(const DesktopRect& rect) {
left_ = std::max(left(), rect.left());
top_ = std::max(top(), rect.top());
right_ = std::min(right(), rect.right());
bottom_ = std::min(bottom(), rect.top());
bottom_ = std::min(bottom(), rect.bottom());
if (is_empty()) {
left_ = 0;
top_ = 0;

View File

@ -47,7 +47,8 @@ void DesktopRegion::IntersectWith(const DesktopRect& rect) {
remove_empty_rects = remove_empty_rects | it->is_empty();
}
if (remove_empty_rects) {
RectsList new_rects(rects_.size());
RectsList new_rects;
new_rects.reserve(rects_.size());
for (RectsList::iterator it = rects_.begin(); it != rects_.end(); ++it) {
if (!it->is_empty())
new_rects.push_back(*it);