summaryrefslogtreecommitdiffstats
path: root/remoting/client/plugin
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-19 21:24:28 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-19 21:24:28 +0000
commitb4e50594c117da39d9d65beed489acc3ce4cd35e (patch)
treeeb321c268adbabfc85ad3dae6931be64c2f92150 /remoting/client/plugin
parentc45d12c0186dbf6a1ffdbb7cb45a15c2366d9dcf (diff)
downloadchromium_src-b4e50594c117da39d9d65beed489acc3ce4cd35e.zip
chromium_src-b4e50594c117da39d9d65beed489acc3ce4cd35e.tar.gz
chromium_src-b4e50594c117da39d9d65beed489acc3ce4cd35e.tar.bz2
Revert 224101 "Remove dependency on Skia from chromoting client."
> Remove dependency on Skia from chromoting client. > > Now DesktopRegion, DesktopRect and DesktopSize are used instead of > corresponding skia types. > > TBR=reed@google.com (for _moved_ skia dependency) > > Review URL: https://chromiumcodereview.appspot.com/23440046 TBR=sergeyu@chromium.org Review URL: https://codereview.chromium.org/24217003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client/plugin')
-rw-r--r--remoting/client/plugin/chromoting_instance.cc18
-rw-r--r--remoting/client/plugin/chromoting_instance.h16
-rw-r--r--remoting/client/plugin/pepper_view.cc60
-rw-r--r--remoting/client/plugin/pepper_view.h34
4 files changed, 64 insertions, 64 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 6cecbaa..066d132 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -351,8 +351,8 @@ bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) {
return input_handler_.HandleInputEvent(event);
}
-void ChromotingInstance::SetDesktopSize(const webrtc::DesktopSize& size,
- const webrtc::DesktopVector& dpi) {
+void ChromotingInstance::SetDesktopSize(const SkISize& size,
+ const SkIPoint& dpi) {
mouse_input_filter_.set_output_size(size);
scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
@@ -365,18 +365,18 @@ void ChromotingInstance::SetDesktopSize(const webrtc::DesktopSize& size,
PostChromotingMessage("onDesktopSize", data.Pass());
}
-void ChromotingInstance::SetDesktopShape(const webrtc::DesktopRegion& shape) {
- if (desktop_shape_ && shape.Equals(*desktop_shape_))
+void ChromotingInstance::SetDesktopShape(const SkRegion& shape) {
+ if (desktop_shape_ && shape == *desktop_shape_)
return;
- desktop_shape_.reset(new webrtc::DesktopRegion(shape));
+ desktop_shape_.reset(new SkRegion(shape));
scoped_ptr<base::ListValue> rects_value(new base::ListValue());
- for (webrtc::DesktopRegion::Iterator i(shape); !i.IsAtEnd(); i.Advance()) {
- const webrtc::DesktopRect& rect = i.rect();
+ for (SkRegion::Iterator i(shape); !i.done(); i.next()) {
+ SkIRect rect = i.rect();
scoped_ptr<base::ListValue> rect_value(new base::ListValue());
- rect_value->AppendInteger(rect.left());
- rect_value->AppendInteger(rect.top());
+ rect_value->AppendInteger(rect.x());
+ rect_value->AppendInteger(rect.y());
rect_value->AppendInteger(rect.width());
rect_value->AppendInteger(rect.height());
rects_value->Append(rect_value.release());
diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h
index 7b120a8..227bcac 100644
--- a/remoting/client/plugin/chromoting_instance.h
+++ b/remoting/client/plugin/chromoting_instance.h
@@ -33,6 +33,9 @@
#include "remoting/protocol/mouse_input_filter.h"
#include "remoting/protocol/negotiating_client_authenticator.h"
#include "remoting/protocol/third_party_client_authenticator.h"
+#include "third_party/skia/include/core/SkPoint.h"
+#include "third_party/skia/include/core/SkRegion.h"
+#include "third_party/skia/include/core/SkSize.h"
namespace base {
class DictionaryValue;
@@ -43,12 +46,6 @@ class InputEvent;
class Module;
} // namespace pp
-namespace webrtc {
-class DesktopRegion;
-class DesktopSize;
-class DesktopVector;
-} // namespace webrtc
-
namespace remoting {
class ChromotingClient;
@@ -135,9 +132,8 @@ class ChromotingInstance :
const protocol::CursorShapeInfo& cursor_shape) OVERRIDE;
// Called by PepperView.
- void SetDesktopSize(const webrtc::DesktopSize& size,
- const webrtc::DesktopVector& dpi);
- void SetDesktopShape(const webrtc::DesktopRegion& shape);
+ void SetDesktopSize(const SkISize& size, const SkIPoint& dpi);
+ void SetDesktopShape(const SkRegion& shape);
void OnFirstFrameReceived();
// Return statistics record by ChromotingClient.
@@ -243,7 +239,7 @@ class ChromotingInstance :
pp::View plugin_view_;
// Contains the most-recently-reported desktop shape, if any.
- scoped_ptr<webrtc::DesktopRegion> desktop_shape_;
+ scoped_ptr<SkRegion> desktop_shape_;
scoped_ptr<DelegatingSignalStrategy> signal_strategy_;
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc
index a0f6ac4..c412316 100644
--- a/remoting/client/plugin/pepper_view.cc
+++ b/remoting/client/plugin/pepper_view.cc
@@ -67,8 +67,14 @@ PepperView::PepperView(ChromotingInstance* instance,
context_(context),
producer_(producer),
merge_buffer_(NULL),
+ merge_clip_area_(SkIRect::MakeEmpty()),
+ dips_size_(SkISize::Make(0, 0)),
dips_to_device_scale_(1.0f),
+ view_size_(SkISize::Make(0, 0)),
dips_to_view_scale_(1.0f),
+ clip_area_(SkIRect::MakeEmpty()),
+ source_size_(SkISize::Make(0, 0)),
+ source_dpi_(SkIPoint::Make(0, 0)),
flush_pending_(false),
is_initialized_(false),
frame_received_(false),
@@ -95,10 +101,10 @@ void PepperView::SetView(const pp::View& view) {
bool view_changed = false;
pp::Rect pp_size = view.GetRect();
- webrtc::DesktopSize new_dips_size(pp_size.width(), pp_size.height());
+ SkISize new_dips_size = SkISize::Make(pp_size.width(), pp_size.height());
float new_dips_to_device_scale = view.GetDeviceScale();
- if (!dips_size_.equals(new_dips_size) ||
+ if (dips_size_ != new_dips_size ||
dips_to_device_scale_ != new_dips_to_device_scale) {
view_changed = true;
dips_to_device_scale_ = new_dips_to_device_scale;
@@ -114,10 +120,11 @@ void PepperView::SetView(const pp::View& view) {
// If the view's DIP dimensions don't match the source then let the frame
// producer do the scaling, and render at device resolution.
- if (!dips_size_.equals(source_size_)) {
+ if (dips_size_ != source_size_) {
dips_to_view_scale_ = dips_to_device_scale_;
- view_size_.set(ceilf(dips_size_.width() * dips_to_view_scale_),
- ceilf(dips_size_.height() * dips_to_view_scale_));
+ view_size_ = SkISize::Make(
+ ceilf(dips_size_.width() * dips_to_view_scale_),
+ ceilf(dips_size_.height() * dips_to_view_scale_));
}
// Create a 2D rendering context at the chosen frame dimensions.
@@ -134,18 +141,18 @@ void PepperView::SetView(const pp::View& view) {
}
pp::Rect pp_clip = view.GetClipRect();
- webrtc::DesktopRect new_clip = webrtc::DesktopRect::MakeLTRB(
+ SkIRect new_clip = SkIRect::MakeLTRB(
floorf(pp_clip.x() * dips_to_view_scale_),
floorf(pp_clip.y() * dips_to_view_scale_),
ceilf(pp_clip.right() * dips_to_view_scale_),
ceilf(pp_clip.bottom() * dips_to_view_scale_));
- if (!clip_area_.equals(new_clip)) {
+ if (clip_area_ != new_clip) {
view_changed = true;
// YUV to RGB conversion may require even X and Y coordinates for
// the top left corner of the clipping area.
clip_area_ = AlignRect(new_clip);
- clip_area_.IntersectWith(webrtc::DesktopRect::MakeSize(view_size_));
+ clip_area_.intersect(SkIRect::MakeSize(view_size_));
}
if (view_changed) {
@@ -154,10 +161,10 @@ void PepperView::SetView(const pp::View& view) {
}
}
-void PepperView::ApplyBuffer(const webrtc::DesktopSize& view_size,
- const webrtc::DesktopRect& clip_area,
+void PepperView::ApplyBuffer(const SkISize& view_size,
+ const SkIRect& clip_area,
webrtc::DesktopFrame* buffer,
- const webrtc::DesktopRegion& region) {
+ const SkRegion& region) {
DCHECK(context_->main_task_runner()->BelongsToCurrentThread());
if (!frame_received_) {
@@ -169,7 +176,7 @@ void PepperView::ApplyBuffer(const webrtc::DesktopSize& view_size,
// TODO(alexeypa): We could rescale and draw it (or even draw it without
// rescaling) to reduce the perceived lag while we are waiting for
// the properly scaled data.
- if (!view_size_.equals(view_size)) {
+ if (view_size_ != view_size) {
FreeBuffer(buffer);
InitiateDrawing();
} else {
@@ -191,11 +198,11 @@ void PepperView::ReturnBuffer(webrtc::DesktopFrame* buffer) {
}
}
-void PepperView::SetSourceSize(const webrtc::DesktopSize& source_size,
- const webrtc::DesktopVector& source_dpi) {
+void PepperView::SetSourceSize(const SkISize& source_size,
+ const SkIPoint& source_dpi) {
DCHECK(context_->main_task_runner()->BelongsToCurrentThread());
- if (source_size_.equals(source_size) && source_dpi_.equals(source_dpi))
+ if (source_size_ == source_size && source_dpi_ == source_dpi)
return;
source_size_ = source_size;
@@ -243,9 +250,9 @@ void PepperView::InitiateDrawing() {
}
}
-void PepperView::FlushBuffer(const webrtc::DesktopRect& clip_area,
+void PepperView::FlushBuffer(const SkIRect& clip_area,
webrtc::DesktopFrame* buffer,
- const webrtc::DesktopRegion& region) {
+ const SkRegion& region) {
// Defer drawing if the flush is already in progress.
if (flush_pending_) {
// |merge_buffer_| is guaranteed to be free here because we allocate only
@@ -262,17 +269,16 @@ void PepperView::FlushBuffer(const webrtc::DesktopRect& clip_area,
// Notify Pepper API about the updated areas and flush pixels to the screen.
base::Time start_time = base::Time::Now();
- for (webrtc::DesktopRegion::Iterator i(region); !i.IsAtEnd(); i.Advance()) {
- webrtc::DesktopRect rect = i.rect();
+ for (SkRegion::Iterator i(region); !i.done(); i.next()) {
+ SkIRect rect = i.rect();
// Re-clip |region| with the current clipping area |clip_area_| because
// the latter could change from the time the buffer was drawn.
- rect.IntersectWith(clip_area_);
- if (rect.is_empty())
+ if (!rect.intersect(clip_area_))
continue;
// Specify the rectangle coordinates relative to the clipping area.
- rect.Translate(-clip_area.left(), -clip_area.top());
+ rect.offset(-clip_area.left(), -clip_area.top());
// Pepper Graphics 2D has a strange and badly documented API that the
// point here is the offset from the source rect. Why?
@@ -284,10 +290,10 @@ void PepperView::FlushBuffer(const webrtc::DesktopRect& clip_area,
// Notify the producer that some parts of the region weren't painted because
// the clipping area has changed already.
- if (!clip_area.equals(clip_area_)) {
- webrtc::DesktopRegion not_painted = region;
- not_painted.Subtract(clip_area_);
- if (!not_painted.is_empty()) {
+ if (clip_area != clip_area_) {
+ SkRegion not_painted = region;
+ not_painted.op(clip_area_, SkRegion::kDifference_Op);
+ if (!not_painted.isEmpty()) {
producer_->InvalidateRegion(not_painted);
}
}
@@ -302,7 +308,7 @@ void PepperView::FlushBuffer(const webrtc::DesktopRect& clip_area,
flush_pending_ = true;
// If the buffer we just rendered has a shape then pass that to JavaScript.
- const webrtc::DesktopRegion* buffer_shape = producer_->GetBufferShape();
+ const SkRegion* buffer_shape = producer_->GetBufferShape();
if (buffer_shape)
instance_->SetDesktopShape(*buffer_shape);
}
diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h
index 4027b620..4848a8e 100644
--- a/remoting/client/plugin/pepper_view.h
+++ b/remoting/client/plugin/pepper_view.h
@@ -16,8 +16,6 @@
#include "ppapi/cpp/point.h"
#include "ppapi/utility/completion_callback_factory.h"
#include "remoting/client/frame_consumer.h"
-#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
-#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
namespace base {
class Time;
@@ -43,26 +41,26 @@ class PepperView : public FrameConsumer {
virtual ~PepperView();
// FrameConsumer implementation.
- virtual void ApplyBuffer(const webrtc::DesktopSize& view_size,
- const webrtc::DesktopRect& clip_area,
+ virtual void ApplyBuffer(const SkISize& view_size,
+ const SkIRect& clip_area,
webrtc::DesktopFrame* buffer,
- const webrtc::DesktopRegion& region) OVERRIDE;
+ const SkRegion& region) OVERRIDE;
virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE;
- virtual void SetSourceSize(const webrtc::DesktopSize& source_size,
- const webrtc::DesktopVector& dpi) OVERRIDE;
+ virtual void SetSourceSize(const SkISize& source_size,
+ const SkIPoint& dpi) OVERRIDE;
// Updates the PepperView's size & clipping area, taking into account the
// DIP-to-device scale factor.
void SetView(const pp::View& view);
// Returns the dimensions of the most recently displayed frame, in pixels.
- const webrtc::DesktopSize& get_source_size() const {
+ const SkISize& get_source_size() const {
return source_size_;
}
// Return the dimensions of the view in Density Independent Pixels (DIPs).
// Note that there may be multiple device pixels per DIP.
- const webrtc::DesktopSize& get_view_size_dips() const {
+ const SkISize& get_view_size_dips() const {
return dips_size_;
}
@@ -82,9 +80,9 @@ class PepperView : public FrameConsumer {
// clip area of the view has changed since the buffer was generated then
// FrameProducer is supplied the missed parts of |region|. The FrameProducer
// will be supplied a new buffer when FlushBuffer() completes.
- void FlushBuffer(const webrtc::DesktopRect& clip_area,
+ void FlushBuffer(const SkIRect& clip_area,
webrtc::DesktopFrame* buffer,
- const webrtc::DesktopRegion& region);
+ const SkRegion& region);
// Handles completion of FlushBuffer(), triggering a new buffer to be
// returned to FrameProducer for rendering.
@@ -109,11 +107,11 @@ class PepperView : public FrameConsumer {
// Queued buffer to paint, with clip area and dirty region in device pixels.
webrtc::DesktopFrame* merge_buffer_;
- webrtc::DesktopRect merge_clip_area_;
- webrtc::DesktopRegion merge_region_;
+ SkIRect merge_clip_area_;
+ SkRegion merge_region_;
// View size in Density Independent Pixels (DIPs).
- webrtc::DesktopSize dips_size_;
+ SkISize dips_size_;
// Scale factor from DIPs to device pixels.
float dips_to_device_scale_;
@@ -121,19 +119,19 @@ class PepperView : public FrameConsumer {
// View size in output pixels. This is the size at which FrameProducer must
// render frames. It usually matches the DIPs size of the view, but may match
// the size in device pixels when scaling is in effect, to reduce artefacts.
- webrtc::DesktopSize view_size_;
+ SkISize view_size_;
// Scale factor from output pixels to device pixels.
float dips_to_view_scale_;
// Visible area of the view, in output pixels.
- webrtc::DesktopRect clip_area_;
+ SkIRect clip_area_;
// Size of the most recent source frame in pixels.
- webrtc::DesktopSize source_size_;
+ SkISize source_size_;
// Resolution of the most recent source frame dots-per-inch.
- webrtc::DesktopVector source_dpi_;
+ SkIPoint source_dpi_;
// True if there is already a Flush() pending on the Graphics2D context.
bool flush_pending_;