summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 19:57:40 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 19:57:40 +0000
commit13b7a84041f48a558efb24725f0568b466b08cfd (patch)
tree0961c2135680b9f3e3441fd467c46828c964213e /remoting
parent125444b5adec00c029d1c80f8aed6a3faad34f59 (diff)
downloadchromium_src-13b7a84041f48a558efb24725f0568b466b08cfd.zip
chromium_src-13b7a84041f48a558efb24725f0568b466b08cfd.tar.gz
chromium_src-13b7a84041f48a558efb24725f0568b466b08cfd.tar.bz2
Revert 103523 - Move us fully from gfx:: over to skia types for consistency.
BUG=NONE TEST=BUILD Review URL: http://codereview.chromium.org/7992011 TBR=dmaclach@chromium.org Review URL: http://codereview.chromium.org/8103006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/DEPS1
-rw-r--r--remoting/base/capture_data.cc2
-rw-r--r--remoting/base/capture_data.h7
-rw-r--r--remoting/base/codec_test.cc12
-rw-r--r--remoting/base/decoder.h12
-rw-r--r--remoting/base/decoder_row_based.cc10
-rw-r--r--remoting/base/decoder_row_based.h8
-rw-r--r--remoting/base/decoder_vp8.cc58
-rw-r--r--remoting/base/decoder_vp8.h31
-rw-r--r--remoting/base/encoder_row_based.cc4
-rw-r--r--remoting/base/encoder_row_based.h2
-rw-r--r--remoting/base/encoder_vp8.cc46
-rw-r--r--remoting/base/encoder_vp8.h15
-rw-r--r--remoting/base/encoder_vp8_unittest.cc14
-rw-r--r--remoting/base/util.cc58
-rw-r--r--remoting/base/util.h15
-rw-r--r--remoting/client/DEPS1
-rw-r--r--remoting/client/frame_consumer.h4
-rw-r--r--remoting/client/plugin/chromoting_instance.cc4
-rw-r--r--remoting/client/plugin/pepper_view.cc36
-rw-r--r--remoting/client/plugin/pepper_view.h15
-rw-r--r--remoting/client/plugin/pepper_view_proxy.cc2
-rw-r--r--remoting/client/plugin/pepper_view_proxy.h2
-rw-r--r--remoting/client/rectangle_update_decoder.cc72
-rw-r--r--remoting/client/rectangle_update_decoder.h12
-rw-r--r--remoting/host/DEPS2
-rw-r--r--remoting/host/capturer.h4
-rw-r--r--remoting/host/capturer_fake.cc8
-rw-r--r--remoting/host/capturer_fake.h6
-rw-r--r--remoting/host/capturer_fake_ascii.cc8
-rw-r--r--remoting/host/capturer_fake_ascii.h4
-rw-r--r--remoting/host/capturer_helper.cc10
-rw-r--r--remoting/host/capturer_helper.h9
-rw-r--r--remoting/host/capturer_linux.cc14
-rw-r--r--remoting/host/capturer_mac.cc19
-rw-r--r--remoting/host/capturer_win.cc38
-rw-r--r--remoting/host/chromoting_host.cc2
-rw-r--r--remoting/host/chromoting_host.h2
-rw-r--r--remoting/host/client_session.cc12
-rw-r--r--remoting/host/client_session.h8
-rw-r--r--remoting/host/client_session_unittest.cc14
-rw-r--r--remoting/host/event_executor_mac.cc2
-rw-r--r--remoting/host/event_executor_win.cc2
-rw-r--r--remoting/host/host_mock_objects.h4
-rw-r--r--remoting/host/local_input_monitor_thread_linux.cc6
-rw-r--r--remoting/host/local_input_monitor_thread_linux.h4
-rw-r--r--remoting/host/screen_recorder_unittest.cc4
-rw-r--r--remoting/remoting.gyp2
48 files changed, 316 insertions, 311 deletions
diff --git a/remoting/base/DEPS b/remoting/base/DEPS
index d7cdc30..baabd9b 100644
--- a/remoting/base/DEPS
+++ b/remoting/base/DEPS
@@ -2,4 +2,5 @@ include_rules = [
"+google/protobuf",
"+net",
"+third_party/zlib",
+ "+ui/gfx",
]
diff --git a/remoting/base/capture_data.cc b/remoting/base/capture_data.cc
index 4daa8dd..b66b239 100644
--- a/remoting/base/capture_data.cc
+++ b/remoting/base/capture_data.cc
@@ -14,7 +14,7 @@ DataPlanes::DataPlanes() {
}
CaptureData::CaptureData(const DataPlanes &data_planes,
- const SkISize& size,
+ const gfx::Size& size,
media::VideoFrame::Format format)
: data_planes_(data_planes),
size_(size),
diff --git a/remoting/base/capture_data.h b/remoting/base/capture_data.h
index 61bc2e8..ae5b89e 100644
--- a/remoting/base/capture_data.h
+++ b/remoting/base/capture_data.h
@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h"
#include "media/base/video_frame.h"
#include "third_party/skia/include/core/SkRegion.h"
+#include "ui/gfx/size.h"
namespace remoting {
@@ -27,7 +28,7 @@ struct DataPlanes {
class CaptureData : public base::RefCountedThreadSafe<CaptureData> {
public:
CaptureData(const DataPlanes &data_planes,
- const SkISize& size,
+ const gfx::Size& size,
media::VideoFrame::Format format);
// Get the data_planes data of the previous capture.
@@ -37,7 +38,7 @@ class CaptureData : public base::RefCountedThreadSafe<CaptureData> {
const SkRegion& dirty_region() const { return dirty_region_; }
// Return the size of the image captured.
- SkISize size() const { return size_; }
+ gfx::Size size() const { return size_; }
// Get the pixel format of the image captured.
media::VideoFrame::Format pixel_format() const { return pixel_format_; }
@@ -62,7 +63,7 @@ class CaptureData : public base::RefCountedThreadSafe<CaptureData> {
private:
const DataPlanes data_planes_;
SkRegion dirty_region_;
- SkISize size_;
+ gfx::Size size_;
media::VideoFrame::Format pixel_format_;
// Time spent in capture. Unit is in milliseconds.
diff --git a/remoting/base/codec_test.cc b/remoting/base/codec_test.cc
index 6754a08..0b62a63 100644
--- a/remoting/base/codec_test.cc
+++ b/remoting/base/codec_test.cc
@@ -165,12 +165,14 @@ class DecoderTester {
// Test the content of the update rect.
ASSERT_EQ(rects_.size(), update_rects_.size());
for (size_t i = 0; i < update_rects_.size(); ++i) {
- EXPECT_EQ(rects_[i], update_rects_[i]);
+ SkIRect &r = rects_[i];
+ gfx::Rect rect(r.fLeft, r.fTop, r.width(), r.height());
+ EXPECT_EQ(rect, update_rects_[i]);
EXPECT_EQ(frame_->stride(0), capture_data_->data_planes().strides[0]);
const int stride = frame_->stride(0);
- const int offset = stride * update_rects_[i].fTop +
- kBytesPerPixel * update_rects_[i].fLeft;
+ const int offset = stride * update_rects_[i].y() +
+ kBytesPerPixel * update_rects_[i].x();
const uint8* original = capture_data_->data_planes().data[0] + offset;
const uint8* decoded = frame_->data(0) + offset;
const int row_size = kBytesPerPixel * update_rects_[i].width();
@@ -186,7 +188,7 @@ class DecoderTester {
private:
bool strict_;
std::deque<SkIRect> rects_;
- RectVector update_rects_;
+ UpdatedRects update_rects_;
Decoder* decoder_;
scoped_refptr<media::VideoFrame> frame_;
scoped_refptr<CaptureData> capture_data_;
@@ -255,7 +257,7 @@ scoped_refptr<CaptureData> PrepareEncodeData(media::VideoFrame::Format format,
planes.strides[0] = kWidth * kBytesPerPixel;
scoped_refptr<CaptureData> data =
- new CaptureData(planes, SkISize::Make(kWidth, kHeight), format);
+ new CaptureData(planes, gfx::Size(kWidth, kHeight), format);
return data;
}
diff --git a/remoting/base/decoder.h b/remoting/base/decoder.h
index dded484..b13483f 100644
--- a/remoting/base/decoder.h
+++ b/remoting/base/decoder.h
@@ -11,11 +11,11 @@
#include "base/task.h"
#include "media/base/video_frame.h"
#include "remoting/proto/video.pb.h"
-#include "third_party/skia/include/core/SkRect.h"
+#include "ui/gfx/rect.h"
namespace remoting {
-typedef std::vector<SkIRect> RectVector;
+typedef std::vector<gfx::Rect> UpdatedRects;
// Interface for a decoder that takes a stream of bytes from the network and
// outputs frames of data.
@@ -46,7 +46,9 @@ class Decoder {
// Returns rects that were updated in the last frame. Can be called only
// after DecodePacket returned DECODE_DONE. Caller keeps ownership of
// |rects|. |rects| is kept empty if whole screen needs to be updated.
- virtual void GetUpdatedRects(RectVector* rects) = 0;
+ // TODO(dmaclach): Move this over to using SkRegion.
+ // http://crbug.com/92085
+ virtual void GetUpdatedRects(UpdatedRects* rects) = 0;
// Reset the decoder to an uninitialized state. Release all references to
// the initialized |frame|. Initialize() must be called before the decoder
@@ -69,13 +71,13 @@ class Decoder {
// effective on the next decoded video frame.
//
// When scaling is enabled clipping rectangles are ignored.
- virtual void SetClipRect(const SkIRect& clip_rect) {}
+ virtual void SetClipRect(const gfx::Rect& clip_rect) {}
// Force decoder to output a video frame with content in |rects| using the
// last decoded video frame.
//
// Coordinates of rectangles supplied here are before scaling.
- virtual void RefreshRects(const RectVector& rects) {}
+ virtual void RefreshRects(const std::vector<gfx::Rect>& rects) {}
};
} // namespace remoting
diff --git a/remoting/base/decoder_row_based.cc b/remoting/base/decoder_row_based.cc
index e6fcf95..f349272 100644
--- a/remoting/base/decoder_row_based.cc
+++ b/remoting/base/decoder_row_based.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -88,8 +88,8 @@ Decoder::DecodeResult DecoderRowBased::DecodePacket(const VideoPacket* packet) {
int stride = frame_->stride(media::VideoFrame::kRGBPlane);
uint8* rect_begin = frame_->data(media::VideoFrame::kRGBPlane);
- uint8* out = rect_begin + stride * (clip_.fTop + row_y_) +
- kBytesPerPixel * clip_.fLeft;
+ uint8* out = rect_begin + stride * (clip_.y() + row_y_) +
+ kBytesPerPixel * clip_.x();
// Consume all the data in the message.
bool decompress_again = true;
@@ -151,7 +151,7 @@ void DecoderRowBased::UpdateStateForPacket(const VideoPacket* packet) {
state_ = kProcessing;
// Reset the buffer location status variables on the first packet.
- clip_.setXYWH(packet->format().x(), packet->format().y(),
+ clip_.SetRect(packet->format().x(), packet->format().y(),
packet->format().width(), packet->format().height());
row_pos_ = 0;
row_y_ = 0;
@@ -184,7 +184,7 @@ void DecoderRowBased::UpdateStateForPacket(const VideoPacket* packet) {
return;
}
-void DecoderRowBased::GetUpdatedRects(RectVector* rects) {
+void DecoderRowBased::GetUpdatedRects(UpdatedRects* rects) {
rects->swap(updated_rects_);
updated_rects_.clear();
}
diff --git a/remoting/base/decoder_row_based.h b/remoting/base/decoder_row_based.h
index e47ed89..2afd60e 100644
--- a/remoting/base/decoder_row_based.h
+++ b/remoting/base/decoder_row_based.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,7 @@ class DecoderRowBased : public Decoder {
virtual bool IsReadyForData();
virtual void Initialize(scoped_refptr<media::VideoFrame> frame);
virtual DecodeResult DecodePacket(const VideoPacket* packet);
- virtual void GetUpdatedRects(RectVector* rects);
+ virtual void GetUpdatedRects(UpdatedRects* rects);
virtual void Reset();
virtual VideoPacketFormat::Encoding Encoding();
@@ -46,7 +46,7 @@ class DecoderRowBased : public Decoder {
State state_;
// Keeps track of the updating rect.
- SkIRect clip_;
+ gfx::Rect clip_;
// The video frame to write to.
scoped_refptr<media::VideoFrame> frame_;
@@ -63,7 +63,7 @@ class DecoderRowBased : public Decoder {
// The current row in the rect that we are updaing.
int row_y_;
- RectVector updated_rects_;
+ UpdatedRects updated_rects_;
DISALLOW_COPY_AND_ASSIGN(DecoderRowBased);
};
diff --git a/remoting/base/decoder_vp8.cc b/remoting/base/decoder_vp8.cc
index 4befd69..234fc07 100644
--- a/remoting/base/decoder_vp8.cc
+++ b/remoting/base/decoder_vp8.cc
@@ -89,14 +89,13 @@ Decoder::DecodeResult DecoderVp8::DecodePacket(const VideoPacket* packet) {
}
last_image_ = image;
- RectVector rects;
- rects.reserve(packet->dirty_rects_size());
+ std::vector<gfx::Rect> rects;
for (int i = 0; i < packet->dirty_rects_size(); ++i) {
- Rect remoting_rect = packet->dirty_rects(i);
- rects.push_back(SkIRect::MakeXYWH(remoting_rect.x(),
- remoting_rect.y(),
- remoting_rect.width(),
- remoting_rect.height()));
+ gfx::Rect r = gfx::Rect(packet->dirty_rects(i).x(),
+ packet->dirty_rects(i).y(),
+ packet->dirty_rects(i).width(),
+ packet->dirty_rects(i).height());
+ rects.push_back(r);
}
if (!DoScaling())
@@ -106,7 +105,7 @@ Decoder::DecodeResult DecoderVp8::DecodePacket(const VideoPacket* packet) {
return DECODE_DONE;
}
-void DecoderVp8::GetUpdatedRects(RectVector* rects) {
+void DecoderVp8::GetUpdatedRects(UpdatedRects* rects) {
rects->swap(updated_rects_);
}
@@ -137,11 +136,11 @@ void DecoderVp8::SetScaleRatios(double horizontal_ratio,
vertical_scale_ratio_ = vertical_ratio;
}
-void DecoderVp8::SetClipRect(const SkIRect& clip_rect) {
+void DecoderVp8::SetClipRect(const gfx::Rect& clip_rect) {
clip_rect_ = clip_rect;
}
-void DecoderVp8::RefreshRects(const RectVector& rects) {
+void DecoderVp8::RefreshRects(const std::vector<gfx::Rect>& rects) {
if (!DoScaling())
ConvertRects(rects, &updated_rects_);
else
@@ -152,8 +151,8 @@ bool DecoderVp8::DoScaling() const {
return horizontal_scale_ratio_ != 1.0 || vertical_scale_ratio_ != 1.0;
}
-void DecoderVp8::ConvertRects(const RectVector& rects,
- RectVector* output_rects) {
+void DecoderVp8::ConvertRects(const UpdatedRects& rects,
+ UpdatedRects* output_rects) {
if (!last_image_)
return;
@@ -161,24 +160,24 @@ void DecoderVp8::ConvertRects(const RectVector& rects,
const int stride = frame_->stride(media::VideoFrame::kRGBPlane);
output_rects->clear();
- output_rects->reserve(rects.size());
for (size_t i = 0; i < rects.size(); ++i) {
- // Clip by the clipping rectangle first.
- SkIRect dest_rect = rects[i];
- if (!dest_rect.intersect(clip_rect_))
- continue;
-
// Round down the image width and height.
int image_width = RoundToTwosMultiple(last_image_->d_w);
int image_height = RoundToTwosMultiple(last_image_->d_h);
+ // Clip by the clipping rectangle first.
+ gfx::Rect dest_rect = rects[i].Intersect(clip_rect_);
+
// Then clip by the rounded down dimension of the image for safety.
- if (!dest_rect.intersect(SkIRect::MakeWH(image_width, image_height)))
- continue;
+ dest_rect = dest_rect.Intersect(
+ gfx::Rect(0, 0, image_width, image_height));
// Align the rectangle to avoid artifacts in color space conversion.
dest_rect = AlignRect(dest_rect);
+ if (dest_rect.IsEmpty())
+ continue;
+
ConvertYUVToRGB32WithRect(last_image_->planes[0],
last_image_->planes[1],
last_image_->planes[2],
@@ -191,8 +190,8 @@ void DecoderVp8::ConvertRects(const RectVector& rects,
}
}
-void DecoderVp8::ScaleAndConvertRects(const RectVector& rects,
- RectVector* output_rects) {
+void DecoderVp8::ScaleAndConvertRects(const UpdatedRects& rects,
+ UpdatedRects* output_rects) {
if (!last_image_)
return;
@@ -200,23 +199,24 @@ void DecoderVp8::ScaleAndConvertRects(const RectVector& rects,
const int stride = frame_->stride(media::VideoFrame::kRGBPlane);
output_rects->clear();
- output_rects->reserve(rects.size());
for (size_t i = 0; i < rects.size(); ++i) {
// Round down the image width and height.
int image_width = RoundToTwosMultiple(last_image_->d_w);
int image_height = RoundToTwosMultiple(last_image_->d_h);
// Clip by the rounded down dimension of the image for safety.
- SkIRect dest_rect = rects[i];
- if (!dest_rect.intersect(SkIRect::MakeWH(image_width, image_height)))
- continue;
+ gfx::Rect dest_rect =
+ rects[i].Intersect(gfx::Rect(0, 0, image_width, image_height));
// Align the rectangle to avoid artifacts in color space conversion.
dest_rect = AlignRect(dest_rect);
- SkIRect scaled_rect = ScaleRect(dest_rect,
- horizontal_scale_ratio_,
- vertical_scale_ratio_);
+ if (dest_rect.IsEmpty())
+ continue;
+
+ gfx::Rect scaled_rect = ScaleRect(dest_rect,
+ horizontal_scale_ratio_,
+ vertical_scale_ratio_);
ScaleYUVToRGB32WithRect(last_image_->planes[0],
last_image_->planes[1],
diff --git a/remoting/base/decoder_vp8.h b/remoting/base/decoder_vp8.h
index 33ec147..7aab0fb 100644
--- a/remoting/base/decoder_vp8.h
+++ b/remoting/base/decoder_vp8.h
@@ -18,16 +18,15 @@ class DecoderVp8 : public Decoder {
virtual ~DecoderVp8();
// Decoder implementations.
- virtual void Initialize(scoped_refptr<media::VideoFrame> frame) OVERRIDE;
- virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE;
- virtual void GetUpdatedRects(RectVector* rects) OVERRIDE;
- virtual bool IsReadyForData() OVERRIDE;
- virtual void Reset() OVERRIDE;
- virtual VideoPacketFormat::Encoding Encoding() OVERRIDE;
- virtual void SetScaleRatios(double horizontal_ratio,
- double vertical_ratio) OVERRIDE;
- virtual void SetClipRect(const SkIRect& clip_rect) OVERRIDE;
- virtual void RefreshRects(const RectVector& rects) OVERRIDE;
+ virtual void Initialize(scoped_refptr<media::VideoFrame> frame);
+ virtual DecodeResult DecodePacket(const VideoPacket* packet);
+ virtual void GetUpdatedRects(UpdatedRects* rects);
+ virtual bool IsReadyForData();
+ virtual void Reset();
+ virtual VideoPacketFormat::Encoding Encoding();
+ virtual void SetScaleRatios(double horizontal_ratio, double vertical_ratio);
+ virtual void SetClipRect(const gfx::Rect& clip_rect);
+ virtual void RefreshRects(const std::vector<gfx::Rect>& rects);
private:
enum State {
@@ -41,14 +40,14 @@ class DecoderVp8 : public Decoder {
// Perform color space conversion on the specified rectangles.
// Write the updated rectangles to |output_rects|.
- void ConvertRects(const RectVector& rects,
- RectVector* output_rects);
+ void ConvertRects(const UpdatedRects& rects,
+ UpdatedRects* output_rects);
// Perform scaling and color space conversion on the specified
// rectangles.
// Write the updated rectangles to |output_rects|.
- void ScaleAndConvertRects(const RectVector& rects,
- RectVector* output_rects);
+ void ScaleAndConvertRects(const UpdatedRects& rects,
+ UpdatedRects* output_rects);
// The internal state of the decoder.
State state_;
@@ -62,10 +61,10 @@ class DecoderVp8 : public Decoder {
vpx_image_t* last_image_;
// Record the updated rects in the last decode.
- RectVector updated_rects_;
+ UpdatedRects updated_rects_;
// Clipping rect for the output of the decoder.
- SkIRect clip_rect_;
+ gfx::Rect clip_rect_;
// Scale factors of the decoded output.
double horizontal_scale_ratio_;
diff --git a/remoting/base/encoder_row_based.cc b/remoting/base/encoder_row_based.cc
index 7e3ca48..75af34a 100644
--- a/remoting/base/encoder_row_based.cc
+++ b/remoting/base/encoder_row_based.cc
@@ -42,7 +42,7 @@ EncoderRowBased::EncoderRowBased(Compressor* compressor,
VideoPacketFormat::Encoding encoding)
: encoding_(encoding),
compressor_(compressor),
- screen_size_(SkISize::Make(0,0)),
+ screen_size_(0, 0),
packet_size_(kPacketSize) {
}
@@ -51,7 +51,7 @@ EncoderRowBased::EncoderRowBased(Compressor* compressor,
int packet_size)
: encoding_(encoding),
compressor_(compressor),
- screen_size_(SkISize::Make(0,0)),
+ screen_size_(0, 0),
packet_size_(packet_size) {
}
diff --git a/remoting/base/encoder_row_based.h b/remoting/base/encoder_row_based.h
index 3faa5f5..6da2cd5 100644
--- a/remoting/base/encoder_row_based.h
+++ b/remoting/base/encoder_row_based.h
@@ -62,7 +62,7 @@ class EncoderRowBased : public Encoder {
scoped_ptr<DataAvailableCallback> callback_;
// The most recent screen size.
- SkISize screen_size_;
+ gfx::Size screen_size_;
int packet_size_;
};
diff --git a/remoting/base/encoder_vp8.cc b/remoting/base/encoder_vp8.cc
index eea1a52..4aae550 100644
--- a/remoting/base/encoder_vp8.cc
+++ b/remoting/base/encoder_vp8.cc
@@ -33,7 +33,7 @@ EncoderVp8::EncoderVp8()
active_map_width_(0),
active_map_height_(0),
last_timestamp_(0),
- size_(SkISize::Make(0, 0)) {
+ size_(0, 0) {
}
EncoderVp8::~EncoderVp8() {
@@ -48,7 +48,7 @@ void EncoderVp8::Destroy() {
}
}
-bool EncoderVp8::Init(const SkISize& size) {
+bool EncoderVp8::Init(const gfx::Size& size) {
Destroy();
size_ = size;
codec_.reset(new vpx_codec_ctx_t());
@@ -134,18 +134,14 @@ bool EncoderVp8::Init(const SkISize& size) {
}
// static
-SkIRect EncoderVp8::AlignAndClipRect(const SkIRect& rect,
- int width, int height) {
- SkIRect screen(SkIRect::MakeWH(RoundToTwosMultiple(width),
- RoundToTwosMultiple(height)));
- if (!screen.intersect(AlignRect(rect))) {
- screen = SkIRect::MakeWH(0, 0);
- }
- return screen;
+gfx::Rect EncoderVp8::AlignAndClipRect(const gfx::Rect& rect,
+ int width, int height) {
+ gfx::Rect screen(RoundToTwosMultiple(width), RoundToTwosMultiple(height));
+ return screen.Intersect(AlignRect(rect));
}
bool EncoderVp8::PrepareImage(scoped_refptr<CaptureData> capture_data,
- RectVector* updated_rects) {
+ std::vector<gfx::Rect>* updated_rects) {
// Perform RGB->YUV conversion.
if (capture_data->pixel_format() != media::VideoFrame::RGB32) {
LOG(ERROR) << "Only RGB32 is supported";
@@ -166,17 +162,18 @@ bool EncoderVp8::PrepareImage(scoped_refptr<CaptureData> capture_data,
DCHECK(updated_rects->empty());
for (SkRegion::Iterator r(region); !r.done(); r.next()) {
// Align the rectangle, report it as updated.
- SkIRect rect = r.rect();
+ SkIRect skRect = r.rect();
+ gfx::Rect rect(skRect.fLeft, skRect.fTop, skRect.width(), skRect.height());
rect = AlignAndClipRect(rect, image_->w, image_->h);
- if (!rect.isEmpty())
+ if (!rect.IsEmpty())
updated_rects->push_back(rect);
ConvertRGB32ToYUVWithRect(in,
y_out,
u_out,
v_out,
- rect.fLeft,
- rect.fTop,
+ rect.x(),
+ rect.y(),
rect.width(),
rect.height(),
in_stride,
@@ -186,19 +183,20 @@ bool EncoderVp8::PrepareImage(scoped_refptr<CaptureData> capture_data,
return true;
}
-void EncoderVp8::PrepareActiveMap(const RectVector& updated_rects) {
+void EncoderVp8::PrepareActiveMap(
+ const std::vector<gfx::Rect>& updated_rects) {
// Clear active map first.
memset(active_map_.get(), 0, active_map_width_ * active_map_height_);
// Mark blocks at active.
for (size_t i = 0; i < updated_rects.size(); ++i) {
- const SkIRect& r = updated_rects[i];
+ const gfx::Rect& r = updated_rects[i];
CHECK(r.width() && r.height());
- int left = r.fLeft / kMacroBlockSize;
- int right = (r.fRight - 1) / kMacroBlockSize;
- int top = r.fTop / kMacroBlockSize;
- int bottom = (r.fBottom - 1) / kMacroBlockSize;
+ int left = r.x() / kMacroBlockSize;
+ int right = (r.right() - 1) / kMacroBlockSize;
+ int top = r.y() / kMacroBlockSize;
+ int bottom = (r.bottom() - 1) / kMacroBlockSize;
CHECK(right < active_map_width_);
CHECK(bottom < active_map_height_);
@@ -221,7 +219,7 @@ void EncoderVp8::Encode(scoped_refptr<CaptureData> capture_data,
initialized_ = ret;
}
- RectVector updated_rects;
+ std::vector<gfx::Rect> updated_rects;
if (!PrepareImage(capture_data, &updated_rects)) {
NOTREACHED() << "Can't image data for encoding";
}
@@ -284,8 +282,8 @@ void EncoderVp8::Encode(scoped_refptr<CaptureData> capture_data,
message->set_client_sequence_number(capture_data->client_sequence_number());
for (size_t i = 0; i < updated_rects.size(); ++i) {
Rect* rect = message->add_dirty_rects();
- rect->set_x(updated_rects[i].fLeft);
- rect->set_y(updated_rects[i].fTop);
+ rect->set_x(updated_rects[i].x());
+ rect->set_y(updated_rects[i].y());
rect->set_width(updated_rects[i].width());
rect->set_height(updated_rects[i].height());
}
diff --git a/remoting/base/encoder_vp8.h b/remoting/base/encoder_vp8.h
index 1d145e8..a74d9f9 100644
--- a/remoting/base/encoder_vp8.h
+++ b/remoting/base/encoder_vp8.h
@@ -9,7 +9,7 @@
#include "base/gtest_prod_util.h"
#include "remoting/base/encoder.h"
-#include "third_party/skia/include/core/SkRect.h"
+#include "ui/gfx/rect.h"
typedef struct vpx_codec_ctx vpx_codec_ctx_t;
typedef struct vpx_image vpx_image_t;
@@ -27,12 +27,10 @@ class EncoderVp8 : public Encoder {
DataAvailableCallback* data_available_callback);
private:
- typedef std::vector<SkIRect> RectVector;
-
FRIEND_TEST_ALL_PREFIXES(EncoderVp8Test, AlignAndClipRect);
// Initialize the encoder. Returns true if successful.
- bool Init(const SkISize& size);
+ bool Init(const gfx::Size& size);
// Destroy the encoder.
void Destroy();
@@ -40,11 +38,11 @@ class EncoderVp8 : public Encoder {
// Prepare |image_| for encoding. Write updated rectangles into
// |updated_rects|. Returns true if successful.
bool PrepareImage(scoped_refptr<CaptureData> capture_data,
- RectVector* updated_rects);
+ std::vector<gfx::Rect>* updated_rects);
// Update the active map according to |updated_rects|. Active map is then
// given to the encoder to speed up encoding.
- void PrepareActiveMap(const RectVector& updated_rects);
+ void PrepareActiveMap(const std::vector<gfx::Rect>& updated_rects);
// Align the sides of the rectangle to multiples of 2 (expanding outwards),
// but ensuring the result stays within the screen area (width, height).
@@ -52,7 +50,8 @@ class EncoderVp8 : public Encoder {
//
// TODO(lambroslambrou): Pull this out if it's useful for other things than
// VP8-encoding?
- static SkIRect AlignAndClipRect(const SkIRect& rect, int width, int height);
+ static gfx::Rect AlignAndClipRect(const gfx::Rect& rect,
+ int width, int height);
// True if the encoder is initialized.
bool initialized_;
@@ -68,7 +67,7 @@ class EncoderVp8 : public Encoder {
scoped_array<uint8> yuv_image_;
// The current frame size.
- SkISize size_;
+ gfx::Size size_;
DISALLOW_COPY_AND_ASSIGN(EncoderVp8);
};
diff --git a/remoting/base/encoder_vp8_unittest.cc b/remoting/base/encoder_vp8_unittest.cc
index 73fb157..0be53d5 100644
--- a/remoting/base/encoder_vp8_unittest.cc
+++ b/remoting/base/encoder_vp8_unittest.cc
@@ -49,12 +49,12 @@ TEST(EncoderVp8Test, TestSizeChangeNoLeak) {
planes.strides[0] = width;
scoped_refptr<CaptureData> capture_data(new CaptureData(
- planes, SkISize::Make(width, height), media::VideoFrame::RGB32));
+ planes, gfx::Size(width, height), media::VideoFrame::RGB32));
encoder.Encode(capture_data, false,
NewCallback(&callback, &EncoderCallback::DataAvailable));
height /= 2;
- capture_data = new CaptureData(planes, SkISize::Make(width, height),
+ capture_data = new CaptureData(planes, gfx::Size(width, height),
media::VideoFrame::RGB32);
encoder.Encode(capture_data, false,
NewCallback(&callback, &EncoderCallback::DataAvailable));
@@ -62,25 +62,25 @@ TEST(EncoderVp8Test, TestSizeChangeNoLeak) {
TEST(EncoderVp8Test, AlignAndClipRect) {
// Simple test case (no clipping).
- SkIRect r1(SkIRect::MakeXYWH(100, 200, 300, 400));
+ gfx::Rect r1(100, 200, 300, 400);
EXPECT_EQ(EncoderVp8::AlignAndClipRect(r1, kIntMax, kIntMax), r1);
// Should expand outward to r1.
- SkIRect r2(SkIRect::MakeXYWH(101, 201, 298, 398));
+ gfx::Rect r2(101, 201, 298, 398);
EXPECT_EQ(EncoderVp8::AlignAndClipRect(r2, kIntMax, kIntMax), r1);
// Test clipping to screen size.
EXPECT_EQ(EncoderVp8::AlignAndClipRect(r1, 110, 220),
- SkIRect::MakeXYWH(100, 200, 10, 20));
+ gfx::Rect(100, 200, 10, 20));
// Rectangle completely off-screen.
- EXPECT_TRUE(EncoderVp8::AlignAndClipRect(r1, 50, 50).isEmpty());
+ EXPECT_TRUE(EncoderVp8::AlignAndClipRect(r1, 50, 50).IsEmpty());
// Clipping to odd-sized screen. An unlikely case, and we might not deal
// with it cleanly in the encoder (we possibly lose 1px at right & bottom
// of screen).
EXPECT_EQ(EncoderVp8::AlignAndClipRect(r1, 199, 299),
- SkIRect::MakeXYWH(100, 200, 98, 98));
+ gfx::Rect(100, 200, 98, 98));
}
} // namespace remoting
diff --git a/remoting/base/util.cc b/remoting/base/util.cc
index e960f09..483d97f 100644
--- a/remoting/base/util.cc
+++ b/remoting/base/util.cc
@@ -54,13 +54,13 @@ void ConvertYUVToRGB32WithRect(const uint8* y_plane,
const uint8* u_plane,
const uint8* v_plane,
uint8* rgb_plane,
- const SkIRect& rect,
+ const gfx::Rect& rect,
int y_stride,
int uv_stride,
int rgb_stride) {
- int rgb_offset = CalculateRGBOffset(rect.fLeft, rect.fTop, rgb_stride);
- int y_offset = CalculateYOffset(rect.fLeft, rect.fTop, y_stride);
- int uv_offset = CalculateUVOffset(rect.fLeft, rect.fTop, uv_stride);
+ int rgb_offset = CalculateRGBOffset(rect.x(), rect.y(), rgb_stride);
+ int y_offset = CalculateYOffset(rect.x(), rect.y(), y_stride);
+ int uv_offset = CalculateUVOffset(rect.x(), rect.y(), uv_stride);
media::ConvertYUVToRGB32(y_plane + y_offset,
u_plane + uv_offset,
@@ -78,20 +78,15 @@ void ScaleYUVToRGB32WithRect(const uint8* y_plane,
const uint8* u_plane,
const uint8* v_plane,
uint8* rgb_plane,
- const SkIRect& source_rect,
- const SkIRect& dest_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Rect& dest_rect,
int y_stride,
int uv_stride,
int rgb_stride) {
- int rgb_offset = CalculateRGBOffset(dest_rect.fLeft,
- dest_rect.fTop,
- rgb_stride);
- int y_offset = CalculateYOffset(source_rect.fLeft,
- source_rect.fTop,
- y_stride);
- int uv_offset = CalculateUVOffset(source_rect.fLeft,
- source_rect.fTop,
- uv_stride);
+ int rgb_offset = CalculateRGBOffset(dest_rect.x(), dest_rect.y(), rgb_stride);
+ int y_offset = CalculateYOffset(source_rect.x(), source_rect.y(), y_stride);
+ int uv_offset = CalculateUVOffset(source_rect.x(),
+ source_rect.y(), uv_stride);
media::ScaleYUVToRGB32(y_plane + y_offset,
u_plane + uv_offset,
@@ -139,23 +134,26 @@ int RoundToTwosMultiple(int x) {
return x & (~1);
}
-SkIRect AlignRect(const SkIRect& rect) {
- int x = RoundToTwosMultiple(rect.fLeft);
- int y = RoundToTwosMultiple(rect.fTop);
- int right = RoundToTwosMultiple(rect.fRight + 1);
- int bottom = RoundToTwosMultiple(rect.fBottom + 1);
- return SkIRect::MakeXYWH(x, y, right - x, bottom - y);
+gfx::Rect AlignRect(const gfx::Rect& rect) {
+ int x = RoundToTwosMultiple(rect.x());
+ int y = RoundToTwosMultiple(rect.y());
+ int right = RoundToTwosMultiple(rect.right() + 1);
+ int bottom = RoundToTwosMultiple(rect.bottom() + 1);
+ return gfx::Rect(x, y, right - x, bottom - y);
}
-SkIRect ScaleRect(const SkIRect& rect,
- double horizontal_ratio,
- double vertical_ratio) {
- int x = rect.fLeft * horizontal_ratio;
- int y = rect.fTop * vertical_ratio;
- int w = rect.fRight * horizontal_ratio - x;
- int h = rect.fBottom * vertical_ratio - y;
-
- return SkIRect::MakeXYWH(x, y, w, h);
+gfx::Rect ScaleRect(const gfx::Rect& rect,
+ double horizontal_ratio,
+ double vertical_ratio) {
+ gfx::Rect scaled_rect(rect.x() * horizontal_ratio,
+ rect.y() * vertical_ratio,
+ 0,
+ 0);
+ scaled_rect.set_width(
+ rect.right() * horizontal_ratio - scaled_rect.x());
+ scaled_rect.set_height(
+ rect.bottom() * vertical_ratio - scaled_rect.y());
+ return scaled_rect;
}
void CopyRect(const uint8* src_plane,
diff --git a/remoting/base/util.h b/remoting/base/util.h
index b60e072..262b551 100644
--- a/remoting/base/util.h
+++ b/remoting/base/util.h
@@ -7,6 +7,7 @@
#include "media/base/video_frame.h"
#include "third_party/skia/include/core/SkRect.h"
+#include "ui/gfx/rect.h"
namespace remoting {
@@ -20,7 +21,7 @@ void ConvertYUVToRGB32WithRect(const uint8* y_plane,
const uint8* u_plane,
const uint8* v_plane,
uint8* rgb_plane,
- const SkIRect& rect,
+ const gfx::Rect& rect,
int y_stride,
int uv_stride,
int rgb_stride);
@@ -29,8 +30,8 @@ void ScaleYUVToRGB32WithRect(const uint8* y_plane,
const uint8* u_plane,
const uint8* v_plane,
uint8* rgb_plane,
- const SkIRect& source_rect,
- const SkIRect& dest_rect,
+ const gfx::Rect& source_rect,
+ const gfx::Rect& dest_rect,
int y_stride,
int uv_stride,
int rgb_stride);
@@ -50,13 +51,13 @@ void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane,
int RoundToTwosMultiple(int x);
// Align the sides of the rectangle to multiples of 2 (expanding outwards).
-SkIRect AlignRect(const SkIRect& rect);
+gfx::Rect AlignRect(const gfx::Rect& rect);
// Return a scaled rectangle using the horizontal and vertical scale
// factors.
-SkIRect ScaleRect(const SkIRect& rect,
- double horizontal_ratio,
- double vertical_ratio);
+gfx::Rect ScaleRect(const gfx::Rect& rect,
+ double horizontal_ratio,
+ double vertical_ratio);
// Copy pixels in the rectangle from source to destination.
void CopyRect(const uint8* src_plane,
diff --git a/remoting/client/DEPS b/remoting/client/DEPS
index 03cd3a6..e50aa3e 100644
--- a/remoting/client/DEPS
+++ b/remoting/client/DEPS
@@ -2,6 +2,7 @@ include_rules = [
"+ppapi",
"+jingle/glue",
"+net",
+ "+ui/gfx",
"+remoting/protocol",
"+remoting/jingle_glue",
diff --git a/remoting/client/frame_consumer.h b/remoting/client/frame_consumer.h
index 339b3a4..90f5e55 100644
--- a/remoting/client/frame_consumer.h
+++ b/remoting/client/frame_consumer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -51,7 +51,7 @@ class FrameConsumer {
// Both |frame| and |rects| are guaranteed to be valid until the |done|
// callback is invoked.
virtual void OnPartialFrameOutput(media::VideoFrame* frame,
- RectVector* rects,
+ UpdatedRects* rects,
Task* done) = 0;
private:
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 1fc4573..d4176ed 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -211,7 +211,7 @@ void ChromotingInstance::DidChangeView(const pp::Rect& position,
const pp::Rect& clip) {
DCHECK(plugin_message_loop_->BelongsToCurrentThread());
- view_->SetPluginSize(SkISize::Make(position.width(), position.height()));
+ view_->SetPluginSize(gfx::Size(position.width(), position.height()));
// TODO(wez): Pass the dimensions of the plugin to the RectangleDecoder
// and let it generate the necessary refresh events.
@@ -225,7 +225,7 @@ void ChromotingInstance::DidChangeView(const pp::Rect& position,
// Notify the RectangleDecoder of the new clip rect.
rectangle_decoder_->UpdateClipRect(
- SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height()));
+ gfx::Rect(clip.x(), clip.y(), clip.width(), clip.height()));
}
bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) {
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc
index 6a58c78..d05a22e 100644
--- a/remoting/client/plugin/pepper_view.cc
+++ b/remoting/client/plugin/pepper_view.cc
@@ -74,7 +74,7 @@ void PepperView::Paint() {
}
}
-void PepperView::SetHostSize(const SkISize& host_size) {
+void PepperView::SetHostSize(const gfx::Size& host_size) {
DCHECK(context_->main_message_loop()->BelongsToCurrentThread());
if (host_size_ == host_size)
@@ -87,10 +87,10 @@ void PepperView::SetHostSize(const SkISize& host_size) {
host_size.width(), host_size.height());
}
-void PepperView::PaintFrame(media::VideoFrame* frame, RectVector* rects) {
+void PepperView::PaintFrame(media::VideoFrame* frame, UpdatedRects* rects) {
DCHECK(context_->main_message_loop()->BelongsToCurrentThread());
- SetHostSize(SkISize::Make(frame->width(), frame->height()));
+ SetHostSize(gfx::Size(frame->width(), frame->height()));
if (!backing_store_.get() || backing_store_->is_null()) {
LOG(ERROR) << "Backing store is not available.";
@@ -108,26 +108,26 @@ void PepperView::PaintFrame(media::VideoFrame* frame, RectVector* rects) {
FlushGraphics(start_time);
}
-bool PepperView::PaintRect(media::VideoFrame* frame, const SkIRect& r) {
+bool PepperView::PaintRect(media::VideoFrame* frame, const gfx::Rect& r) {
const uint8* frame_data = frame->data(media::VideoFrame::kRGBPlane);
const int kFrameStride = frame->stride(media::VideoFrame::kRGBPlane);
const int kBytesPerPixel = GetBytesPerPixel(media::VideoFrame::RGB32);
pp::Size backing_store_size = backing_store_->size();
- SkIRect rect(r);
- if (!rect.intersect(SkIRect::MakeWH(backing_store_size.width(),
- backing_store_size.height()))) {
+ gfx::Rect rect = r.Intersect(gfx::Rect(0, 0, backing_store_size.width(),
+ backing_store_size.height()));
+
+ if (rect.IsEmpty())
return false;
- }
const uint8* in =
frame_data +
- kFrameStride * rect.fTop + // Y offset.
- kBytesPerPixel * rect.fLeft; // X offset.
+ kFrameStride * rect.y() + // Y offset.
+ kBytesPerPixel * rect.x(); // X offset.
uint8* out =
reinterpret_cast<uint8*>(backing_store_->data()) +
- backing_store_->stride() * rect.fTop + // Y offset.
- kBytesPerPixel * rect.fLeft; // X offset.
+ backing_store_->stride() * rect.y() + // Y offset.
+ kBytesPerPixel * rect.x(); // X offset.
// TODO(hclam): We really should eliminate this memory copy.
for (int j = 0; j < rect.height(); ++j) {
@@ -141,7 +141,7 @@ bool PepperView::PaintRect(media::VideoFrame* frame, const SkIRect& r) {
graphics2d_.PaintImageData(
*backing_store_.get(),
pp::Point(0, 0),
- pp::Rect(rect.fLeft, rect.fTop, rect.width(), rect.height()));
+ pp::Rect(rect.x(), rect.y(), rect.width(), rect.height()));
return true;
}
@@ -239,7 +239,7 @@ void PepperView::UpdateLoginStatus(bool success, const std::string& info) {
scriptable_obj->SignalLoginChallenge();
}
-bool PepperView::SetPluginSize(const SkISize& plugin_size) {
+bool PepperView::SetPluginSize(const gfx::Size& plugin_size) {
if (plugin_size_ == plugin_size)
return false;
plugin_size_ = plugin_size;
@@ -252,7 +252,7 @@ bool PepperView::SetPluginSize(const SkISize& plugin_size) {
return false;
}
- if (plugin_size.isEmpty())
+ if (plugin_size.IsEmpty())
return false;
// Allocate the backing store to save the desktop image.
@@ -271,7 +271,7 @@ bool PepperView::SetPluginSize(const SkISize& plugin_size) {
double PepperView::GetHorizontalScaleRatio() const {
if (instance_->DoScaling()) {
- DCHECK(!host_size_.isEmpty());
+ DCHECK(!host_size_.IsEmpty());
return 1.0 * plugin_size_.width() / host_size_.width();
}
return 1.0;
@@ -279,7 +279,7 @@ double PepperView::GetHorizontalScaleRatio() const {
double PepperView::GetVerticalScaleRatio() const {
if (instance_->DoScaling()) {
- DCHECK(!host_size_.isEmpty());
+ DCHECK(!host_size_.IsEmpty());
return 1.0 * plugin_size_.height() / host_size_.height();
}
return 1.0;
@@ -311,7 +311,7 @@ void PepperView::ReleaseFrame(media::VideoFrame* frame) {
}
void PepperView::OnPartialFrameOutput(media::VideoFrame* frame,
- RectVector* rects,
+ UpdatedRects* rects,
Task* done) {
DCHECK(context_->main_message_loop()->BelongsToCurrentThread());
diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h
index 1d52cff..030f70b 100644
--- a/remoting/client/plugin/pepper_view.h
+++ b/remoting/client/plugin/pepper_view.h
@@ -19,6 +19,7 @@
#include "ppapi/cpp/point.h"
#include "remoting/client/chromoting_view.h"
#include "remoting/client/frame_consumer.h"
+#include "ui/gfx/size.h"
namespace remoting {
@@ -55,24 +56,24 @@ class PepperView : public ChromotingView,
Task* done);
virtual void ReleaseFrame(media::VideoFrame* frame);
virtual void OnPartialFrameOutput(media::VideoFrame* frame,
- RectVector* rects,
+ UpdatedRects* rects,
Task* done);
// This is called when the dimension of the plugin element has changed.
// Return true if plugin size has changed, false otherwise.
- bool SetPluginSize(const SkISize& plugin_size);
+ bool SetPluginSize(const gfx::Size& plugin_size);
private:
void OnPaintDone(base::Time paint_start);
// Set the dimension of the entire host screen.
- void SetHostSize(const SkISize& host_size);
+ void SetHostSize(const gfx::Size& host_size);
- void PaintFrame(media::VideoFrame* frame, RectVector* rects);
+ void PaintFrame(media::VideoFrame* frame, UpdatedRects* rects);
// Render the rectangle of |frame| to the backing store.
// Returns true if this rectangle is not clipped.
- bool PaintRect(media::VideoFrame* frame, const SkIRect& rect);
+ bool PaintRect(media::VideoFrame* frame, const gfx::Rect& rect);
// Blanks out a rectangle in an image.
void BlankRect(pp::ImageData& image_data, const pp::Rect& rect);
@@ -98,10 +99,10 @@ class PepperView : public ChromotingView,
bool flush_blocked_;
// The size of the plugin element.
- SkISize plugin_size_;
+ gfx::Size plugin_size_;
// The size of the host screen.
- SkISize host_size_;
+ gfx::Size host_size_;
bool is_static_fill_;
uint32 static_fill_color_;
diff --git a/remoting/client/plugin/pepper_view_proxy.cc b/remoting/client/plugin/pepper_view_proxy.cc
index be37706..3e4bb35 100644
--- a/remoting/client/plugin/pepper_view_proxy.cc
+++ b/remoting/client/plugin/pepper_view_proxy.cc
@@ -146,7 +146,7 @@ void PepperViewProxy::ReleaseFrame(media::VideoFrame* frame) {
}
void PepperViewProxy::OnPartialFrameOutput(media::VideoFrame* frame,
- RectVector* rects,
+ UpdatedRects* rects,
Task* done) {
if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
diff --git a/remoting/client/plugin/pepper_view_proxy.h b/remoting/client/plugin/pepper_view_proxy.h
index e6b7d0a..4f65ce6 100644
--- a/remoting/client/plugin/pepper_view_proxy.h
+++ b/remoting/client/plugin/pepper_view_proxy.h
@@ -61,7 +61,7 @@ class PepperViewProxy : public base::RefCountedThreadSafe<PepperViewProxy>,
Task* done);
virtual void ReleaseFrame(media::VideoFrame* frame);
virtual void OnPartialFrameOutput(media::VideoFrame* frame,
- RectVector* rects,
+ UpdatedRects* rects,
Task* done);
// Remove the reference to |instance_| and |view_| by setting the value to
diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc
index b653e27..b96b7ba 100644
--- a/remoting/client/rectangle_update_decoder.cc
+++ b/remoting/client/rectangle_update_decoder.cc
@@ -20,7 +20,7 @@ namespace remoting {
class PartialFrameCleanup : public Task {
public:
- PartialFrameCleanup(media::VideoFrame* frame, RectVector* rects,
+ PartialFrameCleanup(media::VideoFrame* frame, UpdatedRects* rects,
RectangleUpdateDecoder* decoder)
: frame_(frame), rects_(rects), decoder_(decoder) {
}
@@ -36,7 +36,7 @@ class PartialFrameCleanup : public Task {
private:
scoped_refptr<media::VideoFrame> frame_;
- RectVector* rects_;
+ UpdatedRects* rects_;
scoped_refptr<RectangleUpdateDecoder> decoder_;
};
@@ -52,8 +52,8 @@ RectangleUpdateDecoder::~RectangleUpdateDecoder() {
}
void RectangleUpdateDecoder::Initialize(const SessionConfig& config) {
- initial_screen_size_ = SkISize::Make(config.initial_resolution().width,
- config.initial_resolution().height);
+ initial_screen_size_ = gfx::Size(config.initial_resolution().width,
+ config.initial_resolution().height);
// Initialize decoder based on the selected codec.
ChannelConfig::Codec codec = config.video_config().codec;
@@ -98,20 +98,16 @@ void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet,
// Find the required frame size.
bool has_screen_size = packet->format().has_screen_width() &&
packet->format().has_screen_height();
- SkISize screen_size(SkISize::Make(packet->format().screen_width(),
- packet->format().screen_height()));
+ gfx::Size screen_size(packet->format().screen_width(),
+ packet->format().screen_height());
if (!has_screen_size)
screen_size = initial_screen_size_;
// Find the current frame size.
- int width = 0;
- int height = 0;
- if (frame_) {
- width = static_cast<int>(frame_->width());
- height = static_cast<int>(frame_->height());
- }
-
- SkISize frame_size(SkISize::Make(width, height));
+ gfx::Size frame_size(0, 0);
+ if (frame_)
+ frame_size = gfx::Size(static_cast<int>(frame_->width()),
+ static_cast<int>(frame_->height()));
// Allocate a new frame, if necessary.
if ((!frame_) || (has_screen_size && (screen_size != frame_size))) {
@@ -179,7 +175,7 @@ void RectangleUpdateDecoder::SetScaleRatios(double horizontal_ratio,
decoder_->SetScaleRatios(horizontal_ratio, vertical_ratio);
}
-void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) {
+void RectangleUpdateDecoder::UpdateClipRect(const gfx::Rect& new_clip_rect) {
if (message_loop_ != MessageLoop::current()) {
message_loop_->PostTask(
FROM_HERE,
@@ -193,36 +189,36 @@ void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) {
return;
// Find out the rectangles to show because of clip rect is updated.
- if (new_clip_rect.fTop < clip_rect_.fTop) {
+ if (new_clip_rect.y() < clip_rect_.y()) {
refresh_rects_.push_back(
- SkIRect::MakeXYWH(new_clip_rect.fLeft,
- new_clip_rect.fTop,
- new_clip_rect.width(),
- clip_rect_.fTop - new_clip_rect.fTop));
+ gfx::Rect(new_clip_rect.x(),
+ new_clip_rect.y(),
+ new_clip_rect.width(),
+ clip_rect_.y() - new_clip_rect.y()));
}
- if (new_clip_rect.fLeft < clip_rect_.fLeft) {
+ if (new_clip_rect.x() < clip_rect_.x()) {
refresh_rects_.push_back(
- SkIRect::MakeXYWH(new_clip_rect.fLeft,
- clip_rect_.fTop,
- clip_rect_.fLeft - new_clip_rect.fLeft,
- clip_rect_.height()));
+ gfx::Rect(new_clip_rect.x(),
+ clip_rect_.y(),
+ clip_rect_.x() - new_clip_rect.x(),
+ clip_rect_.height()));
}
- if (new_clip_rect.fRight > clip_rect_.fRight) {
+ if (new_clip_rect.right() > clip_rect_.right()) {
refresh_rects_.push_back(
- SkIRect::MakeXYWH(clip_rect_.fRight,
- clip_rect_.fTop,
- new_clip_rect.fRight - clip_rect_.fRight,
- new_clip_rect.height()));
+ gfx::Rect(clip_rect_.right(),
+ clip_rect_.y(),
+ new_clip_rect.right() - clip_rect_.right(),
+ new_clip_rect.height()));
}
- if (new_clip_rect.fBottom > clip_rect_.fBottom) {
+ if (new_clip_rect.bottom() > clip_rect_.bottom()) {
refresh_rects_.push_back(
- SkIRect::MakeXYWH(new_clip_rect.fLeft,
- clip_rect_.fBottom,
- new_clip_rect.width(),
- new_clip_rect.fBottom - clip_rect_.fBottom));
+ gfx::Rect(new_clip_rect.x(),
+ clip_rect_.bottom(),
+ new_clip_rect.width(),
+ new_clip_rect.bottom() - clip_rect_.bottom()));
}
clip_rect_ = new_clip_rect;
@@ -244,8 +240,8 @@ void RectangleUpdateDecoder::RefreshFullFrame() {
return;
refresh_rects_.push_back(
- SkIRect::MakeWH(static_cast<int>(frame_->width()),
- static_cast<int>(frame_->height())));
+ gfx::Rect(0, 0, static_cast<int>(frame_->width()),
+ static_cast<int>(frame_->height())));
DoRefresh();
}
@@ -255,7 +251,7 @@ void RectangleUpdateDecoder::SubmitToConsumer() {
if (!frame_)
return;
- RectVector* dirty_rects = new RectVector();
+ UpdatedRects* dirty_rects = new UpdatedRects();
decoder_->GetUpdatedRects(dirty_rects);
frame_is_consuming_ = true;
diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h
index d44bb6f..7394bd4 100644
--- a/remoting/client/rectangle_update_decoder.h
+++ b/remoting/client/rectangle_update_decoder.h
@@ -9,6 +9,8 @@
#include "base/task.h"
#include "media/base/video_frame.h"
#include "remoting/base/decoder.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/size.h"
class MessageLoop;
@@ -52,7 +54,7 @@ class RectangleUpdateDecoder :
// report dirty rectangles accordingly to enhance performance.
//
// If scale ratio is not 1.0 then clipping rectangle is ignored.
- void UpdateClipRect(const SkIRect& clip_rect);
+ void UpdateClipRect(const gfx::Rect& clip_rect);
// Force the decoder to output the last decoded video frame without any
// clipping.
@@ -66,7 +68,7 @@ class RectangleUpdateDecoder :
void AllocateFrame(const VideoPacket* packet, Task* done);
void ProcessPacketData(const VideoPacket* packet, Task* done);
- void RefreshRects(const RectVector& rects);
+ void RefreshRects(const std::vector<gfx::Rect>& rects);
// Obtain updated rectangles from decoder and submit it to the consumer.
void SubmitToConsumer();
@@ -83,9 +85,9 @@ class RectangleUpdateDecoder :
MessageLoop* message_loop_;
FrameConsumer* consumer_;
- SkISize initial_screen_size_;
- SkIRect clip_rect_;
- RectVector refresh_rects_;
+ gfx::Size initial_screen_size_;
+ gfx::Rect clip_rect_;
+ std::vector<gfx::Rect> refresh_rects_;
scoped_ptr<Decoder> decoder_;
diff --git a/remoting/host/DEPS b/remoting/host/DEPS
index a6379aa..bc54a47 100644
--- a/remoting/host/DEPS
+++ b/remoting/host/DEPS
@@ -1,5 +1,5 @@
include_rules = [
- "+ui/base",
+ "+ui",
"+base/crypto",
"+net/base",
diff --git a/remoting/host/capturer.h b/remoting/host/capturer.h
index e29b7f5..7d74c17 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 SkISize& size) = 0;
+ virtual void InvalidateScreen(const gfx::Size& 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 SkISize& size_most_recent() const = 0;
+ virtual const gfx::Size& size_most_recent() const = 0;
};
} // namespace remoting
diff --git a/remoting/host/capturer_fake.cc b/remoting/host/capturer_fake.cc
index 88bac10..717e0ad 100644
--- a/remoting/host/capturer_fake.cc
+++ b/remoting/host/capturer_fake.cc
@@ -4,6 +4,8 @@
#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
@@ -37,7 +39,7 @@ CapturerFake::~CapturerFake() {
}
void CapturerFake::ScreenConfigurationChanged() {
- size_ = SkISize::Make(kWidth, kHeight);
+ size_ = gfx::Size(kWidth, kHeight);
bytes_per_row_ = size_.width() * kBytesPerPixel;
pixel_format_ = media::VideoFrame::RGB32;
@@ -60,7 +62,7 @@ void CapturerFake::InvalidateRegion(const SkRegion& invalid_region) {
helper.InvalidateRegion(invalid_region);
}
-void CapturerFake::InvalidateScreen(const SkISize& size) {
+void CapturerFake::InvalidateScreen(const gfx::Size& size) {
helper.InvalidateScreen(size);
}
@@ -92,7 +94,7 @@ void CapturerFake::CaptureInvalidRegion(CaptureCompletedCallback* callback) {
callback->Run(capture_data);
}
-const SkISize& CapturerFake::size_most_recent() const {
+const gfx::Size& 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 252fd40..61f41283 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 SkISize& size) OVERRIDE;
+ virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE;
virtual void InvalidateFullScreen() OVERRIDE;
virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback)
OVERRIDE;
- virtual const SkISize& size_most_recent() const OVERRIDE;
+ virtual const gfx::Size& size_most_recent() const OVERRIDE;
private:
// Generates an image in the front buffer.
void GenerateImage();
- SkISize size_;
+ gfx::Size 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 f2bb5d2..e24bebd 100644
--- a/remoting/host/capturer_fake_ascii.cc
+++ b/remoting/host/capturer_fake_ascii.cc
@@ -4,6 +4,8 @@
#include "remoting/host/capturer_fake_ascii.h"
+#include "ui/gfx/rect.h"
+
namespace remoting {
static const int kWidth = 32;
@@ -43,7 +45,7 @@ void CapturerFakeAscii::InvalidateRegion(const SkRegion& invalid_region) {
helper_.InvalidateRegion(invalid_region);
}
-void CapturerFakeAscii::InvalidateScreen(const SkISize& size) {
+void CapturerFakeAscii::InvalidateScreen(const gfx::Size& size) {
helper_.InvalidateScreen(size);
}
@@ -61,14 +63,14 @@ void CapturerFakeAscii::CaptureInvalidRegion(
current_buffer_ = (current_buffer_ + 1) % kNumBuffers;
planes.strides[0] = bytes_per_row_;
scoped_refptr<CaptureData> capture_data(new CaptureData(
- planes, SkISize::Make(width_, height_), pixel_format_));
+ planes, gfx::Size(width_, height_), pixel_format_));
helper_.set_size_most_recent(capture_data->size());
callback->Run(capture_data);
}
-const SkISize& CapturerFakeAscii::size_most_recent() const {
+const gfx::Size& 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 8902cee..a7c0d3c 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 SkISize& size) OVERRIDE;
+ virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE;
virtual void InvalidateFullScreen() OVERRIDE;
virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback)
OVERRIDE;
- virtual const SkISize& size_most_recent() const;
+ virtual const gfx::Size& 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 cd7c465..12e7d86 100644
--- a/remoting/host/capturer_helper.cc
+++ b/remoting/host/capturer_helper.cc
@@ -6,7 +6,7 @@
namespace remoting {
-CapturerHelper::CapturerHelper() : size_most_recent_(SkISize::Make(0, 0)) {
+CapturerHelper::CapturerHelper() : size_most_recent_(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 SkISize& size) {
+void CapturerHelper::InvalidateScreen(const gfx::Size& 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_.isZero())
+ if (size_most_recent_ != gfx::Size(0, 0))
InvalidateScreen(size_most_recent_);
}
@@ -38,11 +38,11 @@ void CapturerHelper::SwapInvalidRegion(SkRegion* invalid_region) {
invalid_region->swap(invalid_region_);
}
-const SkISize& CapturerHelper::size_most_recent() const {
+const gfx::Size& CapturerHelper::size_most_recent() const {
return size_most_recent_;
}
-void CapturerHelper::set_size_most_recent(const SkISize& size) {
+void CapturerHelper::set_size_most_recent(const gfx::Size& size) {
size_most_recent_ = size;
}
diff --git a/remoting/host/capturer_helper.h b/remoting/host/capturer_helper.h
index 10c95db..e9479e5 100644
--- a/remoting/host/capturer_helper.h
+++ b/remoting/host/capturer_helper.h
@@ -7,6 +7,7 @@
#include "base/synchronization/lock.h"
#include "third_party/skia/include/core/SkRegion.h"
+#include "ui/gfx/size.h"
namespace remoting {
@@ -25,7 +26,7 @@ class CapturerHelper {
void InvalidateRegion(const SkRegion& invalid_region);
// Invalidate the entire screen, of a given size.
- void InvalidateScreen(const SkISize& size);
+ void InvalidateScreen(const gfx::Size& size);
// Invalidate the entire screen, using the size of the most recently
// captured screen.
@@ -35,8 +36,8 @@ class CapturerHelper {
void SwapInvalidRegion(SkRegion* invalid_region);
// Access the size of the most recently captured screen.
- const SkISize& size_most_recent() const;
- void set_size_most_recent(const SkISize& size);
+ const gfx::Size& size_most_recent() const;
+ void set_size_most_recent(const gfx::Size& size);
private:
// A region that has been manually invalidated (through InvalidateRegion).
@@ -48,7 +49,7 @@ class CapturerHelper {
base::Lock invalid_region_lock_;
// The size of the most recently captured screen.
- SkISize size_most_recent_;
+ gfx::Size size_most_recent_;
DISALLOW_COPY_AND_ASSIGN(CapturerHelper);
};
diff --git a/remoting/host/capturer_linux.cc b/remoting/host/capturer_linux.cc
index 062f259..825e724 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_.set(root_attr.width, root_attr.height);
+ size_.SetSize(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 {
}
}
- SkISize size() const { return size_; }
+ gfx::Size 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:
- SkISize size_;
+ gfx::Size 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 SkISize& size) OVERRIDE;
+ virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE;
virtual void InvalidateFullScreen() OVERRIDE;
virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback)
OVERRIDE;
- virtual const SkISize& size_most_recent() const OVERRIDE;
+ virtual const gfx::Size& 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 SkISize& size) {
+void CapturerLinux::InvalidateScreen(const gfx::Size& size) {
helper_.InvalidateScreen(size);
}
@@ -499,7 +499,7 @@ void CapturerLinux::SlowBlit(uint8* image, const SkIRect& rect,
}
}
-const SkISize& CapturerLinux::size_most_recent() const {
+const gfx::Size& 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 49e9319..8b91c45 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_.set(width, height);
+ size_.SetSize(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 {
}
}
- SkISize size() const { return size_; }
+ gfx::Size 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:
- SkISize size_;
+ gfx::Size 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 SkISize& size) OVERRIDE;
+ virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE;
virtual void InvalidateFullScreen() OVERRIDE;
virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback)
OVERRIDE;
- virtual const SkISize& size_most_recent() const OVERRIDE;
+ virtual const gfx::Size& 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(SkISize::Make(width, height));
+ InvalidateScreen(gfx::Size(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 SkISize& size) {
+void CapturerMac::InvalidateScreen(const gfx::Size& size) {
helper_.InvalidateScreen(size);
}
@@ -346,7 +346,8 @@ void CapturerMac::CaptureInvalidRegion(CaptureCompletedCallback* callback) {
(current_buffer.size().height() - 1) * current_buffer.bytes_per_row();
}
- data = new CaptureData(planes, current_buffer.size(), pixel_format());
+ data = new CaptureData(planes, gfx::Size(current_buffer.size()),
+ pixel_format());
data->mutable_dirty_region() = region;
current_buffer_ = (current_buffer_ + 1) % kNumBuffers;
@@ -472,7 +473,7 @@ void CapturerMac::CgBlit(const VideoFrameBuffer& buffer,
}
}
-const SkISize& CapturerMac::size_most_recent() const {
+const gfx::Size& 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 b92459f..b8c46e6 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 SkISize& size) OVERRIDE;
+ virtual void InvalidateScreen(const gfx::Size& size) OVERRIDE;
virtual void InvalidateFullScreen() OVERRIDE;
virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback)
OVERRIDE;
- virtual const SkISize& size_most_recent() const OVERRIDE;
+ virtual const gfx::Size& size_most_recent() const OVERRIDE;
private:
struct VideoFrameBuffer {
- VideoFrameBuffer(void* data, const SkISize& size, int bytes_per_pixel,
+ VideoFrameBuffer(void* data, const gfx::Size& 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 = SkISize::Make(0, 0);
+ size = gfx::Size(0, 0);
bytes_per_pixel = 0;
bytes_per_row = 0;
}
void* data;
- SkISize size;
+ gfx::Size 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 SkISize& size);
+ void UpdateBufferCapture(const gfx::Size& size);
// Allocate memory for a buffer of a given size, freeing any memory previously
// allocated for that buffer.
- void ReallocateBuffer(int buffer_index, const SkISize& size);
+ void ReallocateBuffer(int buffer_index, const gfx::Size& size);
void CalculateInvalidRegion();
void CaptureRegion(const SkRegion& region,
@@ -73,7 +73,7 @@ class CapturerGdi : public Capturer {
void MaybeChangeScreenConfiguration();
// Gets the screen size.
- SkISize GetScreenSize();
+ gfx::Size 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.
- SkISize dc_size_;
+ gfx::Size 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_(SkISize::Make(0, 0)),
+ dc_size_(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 SkISize& size) {
+void CapturerGdi::InvalidateScreen(const gfx::Size& size) {
helper_.InvalidateScreen(size);
}
@@ -151,7 +151,7 @@ void CapturerGdi::CaptureInvalidRegion(CaptureCompletedCallback* callback) {
CaptureRegion(invalid_region, callback);
}
-const SkISize& CapturerGdi::size_most_recent() const {
+const gfx::Size& 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 SkISize& size) {
+void CapturerGdi::UpdateBufferCapture(const gfx::Size& 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 SkISize& size) {
}
}
-void CapturerGdi::ReallocateBuffer(int buffer_index, const SkISize& size) {
+void CapturerGdi::ReallocateBuffer(int buffer_index, const gfx::Size& 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 SkISize& size) {
CreateDIBSection(desktop_dc_, &bmi, DIB_RGB_COLORS,
static_cast<void**>(&buffers_[buffer_index].data),
NULL, 0);
- buffers_[buffer_index].size = SkISize::Make(bmi.bmiHeader.biWidth,
- std::abs(bmi.bmiHeader.biHeight));
+ buffers_[buffer_index].size = gfx::Size(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);
}
-SkISize CapturerGdi::GetScreenSize() {
- return SkISize::Make(GetSystemMetrics(SM_CXSCREEN),
- GetSystemMetrics(SM_CYSCREEN));
+gfx::Size CapturerGdi::GetScreenSize() {
+ return gfx::Size(GetSystemMetrics(SM_CXSCREEN),
+ GetSystemMetrics(SM_CYSCREEN));
}
} // namespace
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 8eb6b33..f11ce8d 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 SkIPoint& new_pos) {
+void ChromotingHost::LocalMouseMoved(const gfx::Point& 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 270c9ba..3f34233 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 SkIPoint& new_pos);
+ void LocalMouseMoved(const gfx::Point& 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 36bb89c..3416069 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).
- 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())));
+ 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())));
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 SkIPoint& mouse_pos) {
+void ClientSession::LocalMouseMoved(const gfx::Point& 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<SkIPoint>::iterator found_position =
+ std::list<gfx::Point>::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 bc35a45..b387984 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 "third_party/skia/include/core/SkPoint.h"
+#include "ui/gfx/point.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 SkIPoint& new_pos);
+ void LocalMouseMoved(const gfx::Point& 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.
- SkIPoint remote_mouse_pos_;
+ gfx::Point 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<SkIPoint> injected_mouse_positions_;
+ std::list<gfx::Point> 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 be66a80..cd621e8 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_.set(1000, 1000);
+ default_screen_size_.SetSize(1000, 1000);
ON_CALL(capturer_, size_most_recent()).WillByDefault(ReturnRef(
default_screen_size_));
@@ -59,7 +59,7 @@ class ClientSessionTest : public testing::Test {
}
protected:
- SkISize default_screen_size_;
+ gfx::Size 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(SkIPoint::Make(mouse_event1.x(),
- mouse_event1.y()));
+ client_session_->LocalMouseMoved(gfx::Point(mouse_event1.x(),
+ mouse_event1.y()));
client_session_->InjectMouseEvent(mouse_event2);
// This one should not.
- client_session_->LocalMouseMoved(SkIPoint::Make(mouse_event1.x(),
- mouse_event1.y()));
+ client_session_->LocalMouseMoved(gfx::Point(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) {
- SkISize screen(SkISize::Make(200, 100));
+ gfx::Size screen(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 512d763..0ca50af 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.
- SkISize size = capturer_->size_most_recent();
+ gfx::Size 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 ebedf25..bf6fead 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;
- SkISize screen_size = capturer_->size_most_recent();
+ gfx::Size 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 a70693a..5503ca8 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 SkISize&));
+ MOCK_METHOD1(InvalidateScreen, void(const gfx::Size&));
MOCK_METHOD0(InvalidateFullScreen, void());
MOCK_METHOD1(CaptureInvalidRegion, void(CaptureCompletedCallback* callback));
- MOCK_CONST_METHOD0(size_most_recent, const SkISize&());
+ MOCK_CONST_METHOD0(size_most_recent, const gfx::Size&());
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 2f429d6..8bfdd36 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) {
- SkIPoint pos(SkIPoint::Make(event->u.keyButtonPointer.rootX,
- event->u.keyButtonPointer.rootY));
+ gfx::Point pos(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 SkIPoint& pos) {
+void LocalInputMonitorThread::LocalMouseMoved(const gfx::Point& 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 567882c..d87470d 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 "third_party/skia/include/core/SkPoint.h"
+#include "ui/gfx/point.h"
typedef struct _XDisplay Display;
@@ -22,7 +22,7 @@ class LocalInputMonitorThread : public base::SimpleThread {
void Stop();
virtual void Run();
- void LocalMouseMoved(const SkIPoint& pos);
+ void LocalMouseMoved(const gfx::Point& 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 4a821e9..f501a62 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;
}
- SkISize size(SkISize::Make(kWidth, kHeight));
+ gfx::Size size(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;
}
- SkISize size(SkISize::Make(kWidth, kHeight));
+ gfx::Size size(kWidth, kHeight);
scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat));
EXPECT_CALL(capturer_, InvalidateFullScreen());
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index bc8087a7..d79b8bb 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -461,10 +461,8 @@
'host/in_memory_host_config.h',
'host/json_host_config.cc',
'host/json_host_config.h',
- 'host/local_input_monitor.h',
'host/local_input_monitor_linux.cc',
'host/local_input_monitor_mac.mm',
- 'host/local_input_monitor_thread_linux.h',
'host/local_input_monitor_thread_linux.cc',
'host/local_input_monitor_win.cc',
'host/register_support_host_request.cc',