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

Unified Diff: remoting/host/capturer_mac_unittest.cc

Issue 7622002: Revert 96327 - Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | « remoting/host/capturer_mac.cc ('k') | remoting/host/capturer_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/capturer_mac_unittest.cc
===================================================================
--- remoting/host/capturer_mac_unittest.cc (revision 96327)
+++ remoting/host/capturer_mac_unittest.cc (working copy)
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
+#include "remoting/base/types.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
@@ -21,12 +22,11 @@
}
void AddDirtyRect() {
- SkIRect rect = SkIRect::MakeXYWH(0, 0, 10, 10);
- region_.op(rect, SkRegion::kUnion_Op);
+ rects_.insert(gfx::Rect(0, 0, 10, 10));
}
scoped_ptr<Capturer> capturer_;
- SkRegion region_;
+ InvalidRects rects_;
};
// CapturerCallback1 verifies that the whole screen is initially dirty.
@@ -44,20 +44,21 @@
CGDirectDisplayID mainDevice = CGMainDisplayID();
int width = CGDisplayPixelsWide(mainDevice);
int height = CGDisplayPixelsHigh(mainDevice);
- SkRegion initial_region(SkIRect::MakeXYWH(0, 0, width, height));
- EXPECT_EQ(initial_region, capture_data->dirty_region());
+ InvalidRects initial_rect;
+ initial_rect.insert(gfx::Rect(0, 0, width, height));
+ EXPECT_EQ(initial_rect, capture_data->dirty_rects());
}
// CapturerCallback2 verifies that a rectangle explicitly marked as dirty is
// propagated correctly.
class CapturerCallback2 {
public:
- explicit CapturerCallback2(const SkRegion& expected_dirty_region)
- : expected_dirty_region_(expected_dirty_region) { }
+ explicit CapturerCallback2(const InvalidRects& expected_dirty_rects)
+ : expected_dirty_rects_(expected_dirty_rects) { }
void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data);
protected:
- SkRegion expected_dirty_region_;
+ InvalidRects expected_dirty_rects_;
private:
DISALLOW_COPY_AND_ASSIGN(CapturerCallback2);
@@ -69,7 +70,7 @@
int width = CGDisplayPixelsWide(mainDevice);
int height = CGDisplayPixelsHigh(mainDevice);
- EXPECT_EQ(expected_dirty_region_, capture_data->dirty_region());
+ EXPECT_EQ(expected_dirty_rects_, capture_data->dirty_rects());
EXPECT_EQ(width, capture_data->size().width());
EXPECT_EQ(height, capture_data->size().height());
const DataPlanes &planes = capture_data->data_planes();
@@ -88,13 +89,13 @@
SCOPED_TRACE("");
// Check that we get an initial full-screen updated.
CapturerCallback1 callback1;
- capturer_->CaptureInvalidRegion(
+ capturer_->CaptureInvalidRects(
NewCallback(&callback1, &CapturerCallback1::CaptureDoneCallback));
// Check that subsequent dirty rects are propagated correctly.
AddDirtyRect();
- CapturerCallback2 callback2(region_);
- capturer_->InvalidateRegion(region_);
- capturer_->CaptureInvalidRegion(
+ CapturerCallback2 callback2(rects_);
+ capturer_->InvalidateRects(rects_);
+ capturer_->CaptureInvalidRects(
NewCallback(&callback2, &CapturerCallback2::CaptureDoneCallback));
}
@@ -102,14 +103,13 @@
namespace gfx {
-std::ostream& operator<<(std::ostream& out, const SkRegion& region) {
- out << "SkRegion(";
- for (SkRegion::Iterator i(region); !i.done(); i.next()) {
- const SkIRect& r = i.rect();
- out << "(" << r.fLeft << "," << r.fTop << ","
- << r.fRight << "," << r.fBottom << ")";
+std::ostream& operator<<(std::ostream& out,
+ const remoting::InvalidRects& rects) {
+ for (remoting::InvalidRects::const_iterator i = rects.begin();
+ i != rects.end();
+ ++i) {
+ out << *i << std::endl;
}
- out << ")";
return out;
}
« no previous file with comments | « remoting/host/capturer_mac.cc ('k') | remoting/host/capturer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698