diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-30 20:35:26 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-30 20:35:26 +0000 |
commit | bcad2686e10ff2ff31c21e2cc77bd1cee6482e9e (patch) | |
tree | 6000696a564ee1d3c005c63947d38e9486d75143 /remoting/host | |
parent | a31de5292f5facfeec460cd2defc0b131851fb7a (diff) | |
download | chromium_src-bcad2686e10ff2ff31c21e2cc77bd1cee6482e9e.zip chromium_src-bcad2686e10ff2ff31c21e2cc77bd1cee6482e9e.tar.gz chromium_src-bcad2686e10ff2ff31c21e2cc77bd1cee6482e9e.tar.bz2 |
Move us fully from gfx:: over to skia types for consistency.
BUG=92085
TEST=BUILD
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=103523
Review URL: http://codereview.chromium.org/7992011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/capturer.h | 4 | ||||
-rw-r--r-- | remoting/host/capturer_fake.cc | 8 | ||||
-rw-r--r-- | remoting/host/capturer_fake.h | 6 | ||||
-rw-r--r-- | remoting/host/capturer_fake_ascii.cc | 8 | ||||
-rw-r--r-- | remoting/host/capturer_fake_ascii.h | 4 | ||||
-rw-r--r-- | remoting/host/capturer_helper.cc | 10 | ||||
-rw-r--r-- | remoting/host/capturer_helper.h | 9 | ||||
-rw-r--r-- | remoting/host/capturer_linux.cc | 14 | ||||
-rw-r--r-- | remoting/host/capturer_mac.cc | 19 | ||||
-rw-r--r-- | remoting/host/capturer_win.cc | 38 | ||||
-rw-r--r-- | remoting/host/chromoting_host.cc | 2 | ||||
-rw-r--r-- | remoting/host/chromoting_host.h | 2 | ||||
-rw-r--r-- | remoting/host/client_session.cc | 12 | ||||
-rw-r--r-- | remoting/host/client_session.h | 8 | ||||
-rw-r--r-- | remoting/host/client_session_unittest.cc | 14 | ||||
-rw-r--r-- | remoting/host/event_executor_mac.cc | 2 | ||||
-rw-r--r-- | remoting/host/event_executor_win.cc | 2 | ||||
-rw-r--r-- | remoting/host/host_mock_objects.h | 4 | ||||
-rw-r--r-- | remoting/host/local_input_monitor_thread_linux.cc | 6 | ||||
-rw-r--r-- | remoting/host/local_input_monitor_thread_linux.h | 4 | ||||
-rw-r--r-- | remoting/host/screen_recorder_unittest.cc | 4 |
21 files changed, 87 insertions, 93 deletions
diff --git a/remoting/host/capturer.h b/remoting/host/capturer.h index 7d74c17..e29b7f5 100644 --- a/remoting/host/capturer.h +++ b/remoting/host/capturer.h @@ -58,7 +58,7 @@ class Capturer { virtual void InvalidateRegion(const SkRegion& invalid_region) = 0; // Invalidate the entire screen, of a given size. - virtual void InvalidateScreen(const gfx::Size& size) = 0; + virtual void InvalidateScreen(const SkISize& size) = 0; // Invalidate the entire screen, using the size of the most recently // captured screen. @@ -76,7 +76,7 @@ class Capturer { virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) = 0; // Get the size of the most recently captured screen. - virtual const gfx::Size& size_most_recent() const = 0; + virtual const SkISize& size_most_recent() const = 0; }; } // namespace remoting diff --git a/remoting/host/capturer_fake.cc b/remoting/host/capturer_fake.cc index 717e0ad..88bac10 100644 --- a/remoting/host/capturer_fake.cc +++ b/remoting/host/capturer_fake.cc @@ -4,8 +4,6 @@ #include "remoting/host/capturer_fake.h" -#include "ui/gfx/rect.h" - namespace remoting { // CapturerFake generates a white picture of size kWidth x kHeight with a @@ -39,7 +37,7 @@ CapturerFake::~CapturerFake() { } void CapturerFake::ScreenConfigurationChanged() { - size_ = gfx::Size(kWidth, kHeight); + size_ = SkISize::Make(kWidth, kHeight); bytes_per_row_ = size_.width() * kBytesPerPixel; pixel_format_ = media::VideoFrame::RGB32; @@ -62,7 +60,7 @@ void CapturerFake::InvalidateRegion(const SkRegion& invalid_region) { helper.InvalidateRegion(invalid_region); } -void CapturerFake::InvalidateScreen(const gfx::Size& size) { +void CapturerFake::InvalidateScreen(const SkISize& size) { helper.InvalidateScreen(size); } @@ -94,7 +92,7 @@ void CapturerFake::CaptureInvalidRegion(CaptureCompletedCallback* callback) { callback->Run(capture_data); } -const gfx::Size& CapturerFake::size_most_recent() const { +const SkISize& CapturerFake::size_most_recent() const { return helper.size_most_recent(); } diff --git a/remoting/host/capturer_fake.h b/remoting/host/capturer_fake.h index 61f41283..252fd40 100644 --- a/remoting/host/capturer_fake.h +++ b/remoting/host/capturer_fake.h @@ -25,17 +25,17 @@ class CapturerFake : public Capturer { virtual media::VideoFrame::Format pixel_format() const OVERRIDE; virtual void ClearInvalidRegion() OVERRIDE; virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; - virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE; + virtual void InvalidateScreen(const SkISize& size) OVERRIDE; virtual void InvalidateFullScreen() OVERRIDE; virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) OVERRIDE; - virtual const gfx::Size& size_most_recent() const OVERRIDE; + virtual const SkISize& size_most_recent() const OVERRIDE; private: // Generates an image in the front buffer. void GenerateImage(); - gfx::Size size_; + SkISize size_; int bytes_per_row_; int box_pos_x_; int box_pos_y_; diff --git a/remoting/host/capturer_fake_ascii.cc b/remoting/host/capturer_fake_ascii.cc index e24bebd..f2bb5d2 100644 --- a/remoting/host/capturer_fake_ascii.cc +++ b/remoting/host/capturer_fake_ascii.cc @@ -4,8 +4,6 @@ #include "remoting/host/capturer_fake_ascii.h" -#include "ui/gfx/rect.h" - namespace remoting { static const int kWidth = 32; @@ -45,7 +43,7 @@ void CapturerFakeAscii::InvalidateRegion(const SkRegion& invalid_region) { helper_.InvalidateRegion(invalid_region); } -void CapturerFakeAscii::InvalidateScreen(const gfx::Size& size) { +void CapturerFakeAscii::InvalidateScreen(const SkISize& size) { helper_.InvalidateScreen(size); } @@ -63,14 +61,14 @@ void CapturerFakeAscii::CaptureInvalidRegion( current_buffer_ = (current_buffer_ + 1) % kNumBuffers; planes.strides[0] = bytes_per_row_; scoped_refptr<CaptureData> capture_data(new CaptureData( - planes, gfx::Size(width_, height_), pixel_format_)); + planes, SkISize::Make(width_, height_), pixel_format_)); helper_.set_size_most_recent(capture_data->size()); callback->Run(capture_data); } -const gfx::Size& CapturerFakeAscii::size_most_recent() const { +const SkISize& CapturerFakeAscii::size_most_recent() const { return helper_.size_most_recent(); } diff --git a/remoting/host/capturer_fake_ascii.h b/remoting/host/capturer_fake_ascii.h index a7c0d3c..8902cee 100644 --- a/remoting/host/capturer_fake_ascii.h +++ b/remoting/host/capturer_fake_ascii.h @@ -26,11 +26,11 @@ class CapturerFakeAscii : public Capturer { virtual media::VideoFrame::Format pixel_format() const OVERRIDE; virtual void ClearInvalidRegion() OVERRIDE; virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; - virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE; + virtual void InvalidateScreen(const SkISize& size) OVERRIDE; virtual void InvalidateFullScreen() OVERRIDE; virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) OVERRIDE; - virtual const gfx::Size& size_most_recent() const; + virtual const SkISize& size_most_recent() const; private: // Generates an image in the front buffer. diff --git a/remoting/host/capturer_helper.cc b/remoting/host/capturer_helper.cc index 12e7d86..cd7c465 100644 --- a/remoting/host/capturer_helper.cc +++ b/remoting/host/capturer_helper.cc @@ -6,7 +6,7 @@ namespace remoting { -CapturerHelper::CapturerHelper() : size_most_recent_(0, 0) { +CapturerHelper::CapturerHelper() : size_most_recent_(SkISize::Make(0, 0)) { } CapturerHelper::~CapturerHelper() { @@ -22,14 +22,14 @@ void CapturerHelper::InvalidateRegion(const SkRegion& invalid_region) { invalid_region_.op(invalid_region, SkRegion::kUnion_Op); } -void CapturerHelper::InvalidateScreen(const gfx::Size& size) { +void CapturerHelper::InvalidateScreen(const SkISize& size) { base::AutoLock auto_invalid_region_lock(invalid_region_lock_); invalid_region_.op(SkIRect::MakeWH(size.width(), size.height()), SkRegion::kUnion_Op); } void CapturerHelper::InvalidateFullScreen() { - if (size_most_recent_ != gfx::Size(0, 0)) + if (!size_most_recent_.isZero()) InvalidateScreen(size_most_recent_); } @@ -38,11 +38,11 @@ void CapturerHelper::SwapInvalidRegion(SkRegion* invalid_region) { invalid_region->swap(invalid_region_); } -const gfx::Size& CapturerHelper::size_most_recent() const { +const SkISize& CapturerHelper::size_most_recent() const { return size_most_recent_; } -void CapturerHelper::set_size_most_recent(const gfx::Size& size) { +void CapturerHelper::set_size_most_recent(const SkISize& size) { size_most_recent_ = size; } diff --git a/remoting/host/capturer_helper.h b/remoting/host/capturer_helper.h index e9479e5..10c95db 100644 --- a/remoting/host/capturer_helper.h +++ b/remoting/host/capturer_helper.h @@ -7,7 +7,6 @@ #include "base/synchronization/lock.h" #include "third_party/skia/include/core/SkRegion.h" -#include "ui/gfx/size.h" namespace remoting { @@ -26,7 +25,7 @@ class CapturerHelper { void InvalidateRegion(const SkRegion& invalid_region); // Invalidate the entire screen, of a given size. - void InvalidateScreen(const gfx::Size& size); + void InvalidateScreen(const SkISize& size); // Invalidate the entire screen, using the size of the most recently // captured screen. @@ -36,8 +35,8 @@ class CapturerHelper { void SwapInvalidRegion(SkRegion* invalid_region); // Access the size of the most recently captured screen. - const gfx::Size& size_most_recent() const; - void set_size_most_recent(const gfx::Size& size); + const SkISize& size_most_recent() const; + void set_size_most_recent(const SkISize& size); private: // A region that has been manually invalidated (through InvalidateRegion). @@ -49,7 +48,7 @@ class CapturerHelper { base::Lock invalid_region_lock_; // The size of the most recently captured screen. - gfx::Size size_most_recent_; + SkISize size_most_recent_; DISALLOW_COPY_AND_ASSIGN(CapturerHelper); }; diff --git a/remoting/host/capturer_linux.cc b/remoting/host/capturer_linux.cc index 825e724..062f259 100644 --- a/remoting/host/capturer_linux.cc +++ b/remoting/host/capturer_linux.cc @@ -41,7 +41,7 @@ class VideoFrameBuffer { XGetWindowAttributes(display, root_window, &root_attr); if (root_attr.width != size_.width() || root_attr.height != size_.height()) { - size_.SetSize(root_attr.width, root_attr.height); + size_.set(root_attr.width, root_attr.height); bytes_per_row_ = size_.width() * kBytesPerPixel; size_t buffer_size = size_.width() * size_.height() * kBytesPerPixel; ptr_.reset(new uint8[buffer_size]); @@ -49,14 +49,14 @@ class VideoFrameBuffer { } } - gfx::Size size() const { return size_; } + SkISize size() const { return size_; } int bytes_per_row() const { return bytes_per_row_; } uint8* ptr() const { return ptr_.get(); } void set_needs_update() { needs_update_ = true; } private: - gfx::Size size_; + SkISize size_; int bytes_per_row_; scoped_array<uint8> ptr_; bool needs_update_; @@ -77,11 +77,11 @@ class CapturerLinux : public Capturer { virtual media::VideoFrame::Format pixel_format() const OVERRIDE; virtual void ClearInvalidRegion() OVERRIDE; virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; - virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE; + virtual void InvalidateScreen(const SkISize& size) OVERRIDE; virtual void InvalidateFullScreen() OVERRIDE; virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) OVERRIDE; - virtual const gfx::Size& size_most_recent() const OVERRIDE; + virtual const SkISize& size_most_recent() const OVERRIDE; private: void InitXDamage(); @@ -254,7 +254,7 @@ void CapturerLinux::InvalidateRegion(const SkRegion& invalid_region) { helper_.InvalidateRegion(invalid_region); } -void CapturerLinux::InvalidateScreen(const gfx::Size& size) { +void CapturerLinux::InvalidateScreen(const SkISize& size) { helper_.InvalidateScreen(size); } @@ -499,7 +499,7 @@ void CapturerLinux::SlowBlit(uint8* image, const SkIRect& rect, } } -const gfx::Size& CapturerLinux::size_most_recent() const { +const SkISize& CapturerLinux::size_most_recent() const { return helper_.size_most_recent(); } diff --git a/remoting/host/capturer_mac.cc b/remoting/host/capturer_mac.cc index 8b91c45..49e9319 100644 --- a/remoting/host/capturer_mac.cc +++ b/remoting/host/capturer_mac.cc @@ -102,7 +102,7 @@ class VideoFrameBuffer { int width = CGDisplayPixelsWide(mainDevice); int height = CGDisplayPixelsHigh(mainDevice); if (width != size_.width() || height != size_.height()) { - size_.SetSize(width, height); + size_.set(width, height); bytes_per_row_ = width * sizeof(uint32_t); size_t buffer_size = width * height * sizeof(uint32_t); ptr_.reset(new uint8[buffer_size]); @@ -110,14 +110,14 @@ class VideoFrameBuffer { } } - gfx::Size size() const { return size_; } + SkISize size() const { return size_; } int bytes_per_row() const { return bytes_per_row_; } uint8* ptr() const { return ptr_.get(); } void set_needs_update() { needs_update_ = true; } private: - gfx::Size size_; + SkISize size_; int bytes_per_row_; scoped_array<uint8> ptr_; bool needs_update_; @@ -138,11 +138,11 @@ class CapturerMac : public Capturer { virtual media::VideoFrame::Format pixel_format() const OVERRIDE; virtual void ClearInvalidRegion() OVERRIDE; virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; - virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE; + virtual void InvalidateScreen(const SkISize& size) OVERRIDE; virtual void InvalidateFullScreen() OVERRIDE; virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) OVERRIDE; - virtual const gfx::Size& size_most_recent() const OVERRIDE; + virtual const SkISize& size_most_recent() const OVERRIDE; private: void GlBlitFast(const VideoFrameBuffer& buffer, const SkRegion& region); @@ -262,7 +262,7 @@ void CapturerMac::ScreenConfigurationChanged() { CGDirectDisplayID mainDevice = CGMainDisplayID(); int width = CGDisplayPixelsWide(mainDevice); int height = CGDisplayPixelsHigh(mainDevice); - InvalidateScreen(gfx::Size(width, height)); + InvalidateScreen(SkISize::Make(width, height)); if (!CGDisplayUsesOpenGLAcceleration(mainDevice)) { VLOG(3) << "OpenGL support not available."; @@ -303,7 +303,7 @@ void CapturerMac::InvalidateRegion(const SkRegion& invalid_region) { helper_.InvalidateRegion(invalid_region); } -void CapturerMac::InvalidateScreen(const gfx::Size& size) { +void CapturerMac::InvalidateScreen(const SkISize& size) { helper_.InvalidateScreen(size); } @@ -346,8 +346,7 @@ void CapturerMac::CaptureInvalidRegion(CaptureCompletedCallback* callback) { (current_buffer.size().height() - 1) * current_buffer.bytes_per_row(); } - data = new CaptureData(planes, gfx::Size(current_buffer.size()), - pixel_format()); + data = new CaptureData(planes, current_buffer.size(), pixel_format()); data->mutable_dirty_region() = region; current_buffer_ = (current_buffer_ + 1) % kNumBuffers; @@ -473,7 +472,7 @@ void CapturerMac::CgBlit(const VideoFrameBuffer& buffer, } } -const gfx::Size& CapturerMac::size_most_recent() const { +const SkISize& CapturerMac::size_most_recent() const { return helper_.size_most_recent(); } diff --git a/remoting/host/capturer_win.cc b/remoting/host/capturer_win.cc index b8c46e6..b92459f 100644 --- a/remoting/host/capturer_win.cc +++ b/remoting/host/capturer_win.cc @@ -28,37 +28,37 @@ class CapturerGdi : public Capturer { virtual media::VideoFrame::Format pixel_format() const OVERRIDE; virtual void ClearInvalidRegion() OVERRIDE; virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; - virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE; + virtual void InvalidateScreen(const SkISize& size) OVERRIDE; virtual void InvalidateFullScreen() OVERRIDE; virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) OVERRIDE; - virtual const gfx::Size& size_most_recent() const OVERRIDE; + virtual const SkISize& size_most_recent() const OVERRIDE; private: struct VideoFrameBuffer { - VideoFrameBuffer(void* data, const gfx::Size& size, int bytes_per_pixel, + VideoFrameBuffer(void* data, const SkISize& size, int bytes_per_pixel, int bytes_per_row) : data(data), size(size), bytes_per_pixel(bytes_per_pixel), bytes_per_row(bytes_per_row) { } VideoFrameBuffer() { data = 0; - size = gfx::Size(0, 0); + size = SkISize::Make(0, 0); bytes_per_pixel = 0; bytes_per_row = 0; } void* data; - gfx::Size size; + SkISize size; int bytes_per_pixel; int bytes_per_row; }; // Make sure that the current buffer has the same size as the screen. - void UpdateBufferCapture(const gfx::Size& size); + void UpdateBufferCapture(const SkISize& size); // Allocate memory for a buffer of a given size, freeing any memory previously // allocated for that buffer. - void ReallocateBuffer(int buffer_index, const gfx::Size& size); + void ReallocateBuffer(int buffer_index, const SkISize& size); void CalculateInvalidRegion(); void CaptureRegion(const SkRegion& region, @@ -73,7 +73,7 @@ class CapturerGdi : public Capturer { void MaybeChangeScreenConfiguration(); // Gets the screen size. - gfx::Size GetScreenSize(); + SkISize GetScreenSize(); // A thread-safe list of invalid rectangles, and the size of the most // recently captured screen. @@ -90,7 +90,7 @@ class CapturerGdi : public Capturer { // The screen size attached to the device contexts through which the screen // is captured. - gfx::Size dc_size_; + SkISize dc_size_; // The current buffer with valid data for reading. int current_buffer_; @@ -112,7 +112,7 @@ static const int kBytesPerPixel = 4; CapturerGdi::CapturerGdi() : desktop_dc_(NULL), memory_dc_(NULL), - dc_size_(0, 0), + dc_size_(SkISize::Make(0, 0)), current_buffer_(0), pixel_format_(media::VideoFrame::RGB32) { memset(target_bitmap_, 0, sizeof(target_bitmap_)); @@ -136,7 +136,7 @@ void CapturerGdi::InvalidateRegion(const SkRegion& invalid_region) { helper_.InvalidateRegion(invalid_region); } -void CapturerGdi::InvalidateScreen(const gfx::Size& size) { +void CapturerGdi::InvalidateScreen(const SkISize& size) { helper_.InvalidateScreen(size); } @@ -151,7 +151,7 @@ void CapturerGdi::CaptureInvalidRegion(CaptureCompletedCallback* callback) { CaptureRegion(invalid_region, callback); } -const gfx::Size& CapturerGdi::size_most_recent() const { +const SkISize& CapturerGdi::size_most_recent() const { return helper_.size_most_recent(); } @@ -178,7 +178,7 @@ void CapturerGdi::ScreenConfigurationChanged() { // We poll for screen configuration changes, so ignore notifications. } -void CapturerGdi::UpdateBufferCapture(const gfx::Size& size) { +void CapturerGdi::UpdateBufferCapture(const SkISize& size) { // Make sure the DCs have the correct dimensions. if (size != dc_size_) { // TODO(simonmorris): screen dimensions changing isn't equivalent to needing @@ -197,7 +197,7 @@ void CapturerGdi::UpdateBufferCapture(const gfx::Size& size) { } } -void CapturerGdi::ReallocateBuffer(int buffer_index, const gfx::Size& size) { +void CapturerGdi::ReallocateBuffer(int buffer_index, const SkISize& size) { // Delete any previously constructed bitmap. if (target_bitmap_[buffer_index]) { DeleteObject(target_bitmap_[buffer_index]); @@ -232,8 +232,8 @@ void CapturerGdi::ReallocateBuffer(int buffer_index, const gfx::Size& size) { CreateDIBSection(desktop_dc_, &bmi, DIB_RGB_COLORS, static_cast<void**>(&buffers_[buffer_index].data), NULL, 0); - buffers_[buffer_index].size = gfx::Size(bmi.bmiHeader.biWidth, - std::abs(bmi.bmiHeader.biHeight)); + buffers_[buffer_index].size = SkISize::Make(bmi.bmiHeader.biWidth, + std::abs(bmi.bmiHeader.biHeight)); buffers_[buffer_index].bytes_per_pixel = bmi.bmiHeader.biBitCount / 8; buffers_[buffer_index].bytes_per_row = bmi.bmiHeader.biSizeImage / std::abs(bmi.bmiHeader.biHeight); @@ -310,9 +310,9 @@ void CapturerGdi::CaptureImage() { SRCCOPY | CAPTUREBLT); } -gfx::Size CapturerGdi::GetScreenSize() { - return gfx::Size(GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN)); +SkISize CapturerGdi::GetScreenSize() { + return SkISize::Make(GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN)); } } // namespace diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index f11ce8d..8eb6b33 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -321,7 +321,7 @@ void ChromotingHost::set_protocol_config( protocol_config_.reset(config); } -void ChromotingHost::LocalMouseMoved(const gfx::Point& new_pos) { +void ChromotingHost::LocalMouseMoved(const SkIPoint& new_pos) { if (!context_->network_message_loop()->BelongsToCurrentThread()) { context_->network_message_loop()->PostTask( FROM_HERE, base::Bind(&ChromotingHost::LocalMouseMoved, this, new_pos)); diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h index 3f34233..270c9ba 100644 --- a/remoting/host/chromoting_host.h +++ b/remoting/host/chromoting_host.h @@ -144,7 +144,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, // Notify all active client sessions that local input has been detected, and // that remote input should be ignored for a short time. - void LocalMouseMoved(const gfx::Point& new_pos); + void LocalMouseMoved(const SkIPoint& new_pos); // Pause or unpause the session. While the session is paused, remote input // is ignored. diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index 3416069..36bb89c 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -94,10 +94,10 @@ void ClientSession::InjectMouseEvent(const MouseEvent& event) { // the event to lie within the current screen area. This is better than // simply discarding the event, which might lose a button-up event at the // end of a drag'n'drop (or cause other related problems). - gfx::Point pos(event.x(), event.y()); - const gfx::Size& screen = capturer_->size_most_recent(); - pos.set_x(std::max(0, std::min(screen.width() - 1, pos.x()))); - pos.set_y(std::max(0, std::min(screen.height() - 1, pos.y()))); + SkIPoint pos(SkIPoint::Make(event.x(), event.y())); + const SkISize& screen = capturer_->size_most_recent(); + pos.setX(std::max(0, std::min(screen.width() - 1, pos.x()))); + pos.setY(std::max(0, std::min(screen.height() - 1, pos.y()))); event_to_inject.set_x(pos.x()); event_to_inject.set_y(pos.y()); @@ -121,11 +121,11 @@ void ClientSession::OnDisconnected() { authenticated_ = false; } -void ClientSession::LocalMouseMoved(const gfx::Point& mouse_pos) { +void ClientSession::LocalMouseMoved(const SkIPoint& mouse_pos) { // If this is a genuine local input event (rather than an echo of a remote // input event that we've just injected), then ignore remote inputs for a // short time. - std::list<gfx::Point>::iterator found_position = + std::list<SkIPoint>::iterator found_position = std::find(injected_mouse_positions_.begin(), injected_mouse_positions_.end(), mouse_pos); if (found_position != injected_mouse_positions_.end()) { diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index b387984..bc35a45 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h @@ -12,7 +12,7 @@ #include "remoting/protocol/connection_to_client.h" #include "remoting/protocol/host_stub.h" #include "remoting/protocol/input_stub.h" -#include "ui/gfx/point.h" +#include "third_party/skia/include/core/SkPoint.h" namespace remoting { @@ -80,7 +80,7 @@ class ClientSession : public protocol::HostStub, // Indicate that local mouse activity has been detected. This causes remote // inputs to be ignored for a short time so that the local user will always // have the upper hand in 'pointer wars'. - void LocalMouseMoved(const gfx::Point& new_pos); + void LocalMouseMoved(const SkIPoint& new_pos); bool ShouldIgnoreRemoteMouseInput(const protocol::MouseEvent& event) const; bool ShouldIgnoreRemoteKeyboardInput(const protocol::KeyEvent& event) const; @@ -130,12 +130,12 @@ class ClientSession : public protocol::HostStub, // Current location of the mouse pointer. This is used to provide appropriate // coordinates when we release the mouse buttons after a user disconnects. - gfx::Point remote_mouse_pos_; + SkIPoint remote_mouse_pos_; // Queue of recently-injected mouse positions. This is used to detect whether // mouse events from the local input monitor are echoes of injected positions, // or genuine mouse movements of a local input device. - std::list<gfx::Point> injected_mouse_positions_; + std::list<SkIPoint> injected_mouse_positions_; base::Time latest_local_input_time_; diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index cd621e8..be66a80 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc @@ -45,7 +45,7 @@ class ClientSessionTest : public testing::Test { EXPECT_CALL(*connection_, session()).WillRepeatedly(Return(&session_)); // Set up a large default screen size that won't affect most tests. - default_screen_size_.SetSize(1000, 1000); + default_screen_size_.set(1000, 1000); ON_CALL(capturer_, size_most_recent()).WillByDefault(ReturnRef( default_screen_size_)); @@ -59,7 +59,7 @@ class ClientSessionTest : public testing::Test { } protected: - gfx::Size default_screen_size_; + SkISize default_screen_size_; MessageLoop message_loop_; std::string client_jid_; MockSession session_; @@ -170,12 +170,12 @@ TEST_F(ClientSessionTest, LocalInputTest) { // This event should get through to the input stub. client_session_->InjectMouseEvent(mouse_event1); // This one should too because the local event echoes the remote one. - client_session_->LocalMouseMoved(gfx::Point(mouse_event1.x(), - mouse_event1.y())); + client_session_->LocalMouseMoved(SkIPoint::Make(mouse_event1.x(), + mouse_event1.y())); client_session_->InjectMouseEvent(mouse_event2); // This one should not. - client_session_->LocalMouseMoved(gfx::Point(mouse_event1.x(), - mouse_event1.y())); + client_session_->LocalMouseMoved(SkIPoint::Make(mouse_event1.x(), + mouse_event1.y())); client_session_->InjectMouseEvent(mouse_event3); // TODO(jamiewalch): Verify that remote inputs are re-enabled eventually // (via dependency injection, not sleep!) @@ -208,7 +208,7 @@ TEST_F(ClientSessionTest, RestoreEventState) { } TEST_F(ClientSessionTest, ClampMouseEvents) { - gfx::Size screen(200, 100); + SkISize screen(SkISize::Make(200, 100)); EXPECT_CALL(capturer_, size_most_recent()) .WillRepeatedly(ReturnRef(screen)); diff --git a/remoting/host/event_executor_mac.cc b/remoting/host/event_executor_mac.cc index 0ca50af..512d763 100644 --- a/remoting/host/event_executor_mac.cc +++ b/remoting/host/event_executor_mac.cc @@ -231,7 +231,7 @@ void EventExecutorMac::InjectMouseEvent(const MouseEvent& event) { // TODO(wez): This code assumes that MouseEvent(0,0) (top-left of client view) // corresponds to local (0,0) (top-left of primary monitor). That won't in // general be true on multi-monitor systems, though. - gfx::Size size = capturer_->size_most_recent(); + SkISize size = capturer_->size_most_recent(); if (event.x() >= 0 || event.y() >= 0 || event.x() < size.width() || event.y() < size.height()) { VLOG(3) << "Moving mouse to " << event.x() << "," << event.y(); diff --git a/remoting/host/event_executor_win.cc b/remoting/host/event_executor_win.cc index bf6fead..ebedf25 100644 --- a/remoting/host/event_executor_win.cc +++ b/remoting/host/event_executor_win.cc @@ -109,7 +109,7 @@ void EventExecutorWin::HandleMouse(const MouseEvent& event) { INPUT input; input.type = INPUT_MOUSE; input.mi.time = 0; - gfx::Size screen_size = capturer_->size_most_recent(); + SkISize screen_size = capturer_->size_most_recent(); if ((screen_size.width() > 0) && (screen_size.height() > 0)) { input.mi.dx = static_cast<int>((x * 65535) / screen_size.width()); input.mi.dy = static_cast<int>((y * 65535) / screen_size.height()); diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h index 5503ca8..a70693a 100644 --- a/remoting/host/host_mock_objects.h +++ b/remoting/host/host_mock_objects.h @@ -28,10 +28,10 @@ class MockCapturer : public Capturer { MOCK_CONST_METHOD0(pixel_format, media::VideoFrame::Format()); MOCK_METHOD0(ClearInvalidRegion, void()); MOCK_METHOD1(InvalidateRegion, void(const SkRegion& invalid_region)); - MOCK_METHOD1(InvalidateScreen, void(const gfx::Size&)); + MOCK_METHOD1(InvalidateScreen, void(const SkISize&)); MOCK_METHOD0(InvalidateFullScreen, void()); MOCK_METHOD1(CaptureInvalidRegion, void(CaptureCompletedCallback* callback)); - MOCK_CONST_METHOD0(size_most_recent, const gfx::Size&()); + MOCK_CONST_METHOD0(size_most_recent, const SkISize&()); private: DISALLOW_COPY_AND_ASSIGN(MockCapturer); diff --git a/remoting/host/local_input_monitor_thread_linux.cc b/remoting/host/local_input_monitor_thread_linux.cc index 8bfdd36..2f429d6 100644 --- a/remoting/host/local_input_monitor_thread_linux.cc +++ b/remoting/host/local_input_monitor_thread_linux.cc @@ -50,8 +50,8 @@ static void ProcessReply(XPointer thread, if (data->category == XRecordFromServer) { xEvent* event = reinterpret_cast<xEvent*>(data->data); if (event->u.u.type == MotionNotify) { - gfx::Point pos(event->u.keyButtonPointer.rootX, - event->u.keyButtonPointer.rootY); + SkIPoint pos(SkIPoint::Make(event->u.keyButtonPointer.rootX, + event->u.keyButtonPointer.rootY)); reinterpret_cast<LocalInputMonitorThread*>(thread)->LocalMouseMoved(pos); } else { reinterpret_cast<LocalInputMonitorThread*>(thread)->LocalKeyPressed( @@ -162,7 +162,7 @@ void LocalInputMonitorThread::Run() { display_ = NULL; } -void LocalInputMonitorThread::LocalMouseMoved(const gfx::Point& pos) { +void LocalInputMonitorThread::LocalMouseMoved(const SkIPoint& pos) { host_->LocalMouseMoved(pos); } diff --git a/remoting/host/local_input_monitor_thread_linux.h b/remoting/host/local_input_monitor_thread_linux.h index d87470d..567882c 100644 --- a/remoting/host/local_input_monitor_thread_linux.h +++ b/remoting/host/local_input_monitor_thread_linux.h @@ -6,7 +6,7 @@ #define LOCAL_INPUT_MONITOR_THREAD_LINUX_H_ #include "base/threading/simple_thread.h" -#include "ui/gfx/point.h" +#include "third_party/skia/include/core/SkPoint.h" typedef struct _XDisplay Display; @@ -22,7 +22,7 @@ class LocalInputMonitorThread : public base::SimpleThread { void Stop(); virtual void Run(); - void LocalMouseMoved(const gfx::Point& pos); + void LocalMouseMoved(const SkIPoint& pos); void LocalKeyPressed(int key_code, bool down); private: diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc index f501a62..4a821e9 100644 --- a/remoting/host/screen_recorder_unittest.cc +++ b/remoting/host/screen_recorder_unittest.cc @@ -112,7 +112,7 @@ TEST_F(ScreenRecorderTest, OneRecordCycle) { planes.data[i] = reinterpret_cast<uint8*>(i); planes.strides[i] = kWidth * 4; } - gfx::Size size(kWidth, kHeight); + SkISize size(SkISize::Make(kWidth, kHeight)); scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat)); EXPECT_CALL(capturer_, InvalidateFullScreen()); @@ -161,7 +161,7 @@ TEST_F(ScreenRecorderTest, StartAndStop) { planes.strides[i] = kWidth * 4; } - gfx::Size size(kWidth, kHeight); + SkISize size(SkISize::Make(kWidth, kHeight)); scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat)); EXPECT_CALL(capturer_, InvalidateFullScreen()); |