summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 10:16:41 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 10:16:41 +0000
commitda4daa7ff7b7393e7fa4491d1435653d8aa106a5 (patch)
tree5fba881f404af703dfa9b58a35a1ac2671971a0a /remoting/client
parent12ffada4b59da14b009815b59b77350fdb3599a4 (diff)
downloadchromium_src-da4daa7ff7b7393e7fa4491d1435653d8aa106a5.zip
chromium_src-da4daa7ff7b7393e7fa4491d1435653d8aa106a5.tar.gz
chromium_src-da4daa7ff7b7393e7fa4491d1435653d8aa106a5.tar.bz2
Added the desktop shape fields to VideoPacket.
If the host passes the desktop shape region in a VideoPacket the client will use it to draw transparent regions. The client also informs the web-app of the desktop shape changes, so it can set the input passthrough region correctly. Review URL: https://chromiumcodereview.appspot.com/17511004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/frame_producer.h3
-rw-r--r--remoting/client/plugin/chromoting_instance.cc24
-rw-r--r--remoting/client/plugin/chromoting_instance.h5
-rw-r--r--remoting/client/plugin/pepper_view.cc7
-rw-r--r--remoting/client/rectangle_update_decoder.cc4
-rw-r--r--remoting/client/rectangle_update_decoder.h1
6 files changed, 42 insertions, 2 deletions
diff --git a/remoting/client/frame_producer.h b/remoting/client/frame_producer.h
index 340fbb59..3506e8f 100644
--- a/remoting/client/frame_producer.h
+++ b/remoting/client/frame_producer.h
@@ -42,6 +42,9 @@ class FrameProducer {
virtual void SetOutputSizeAndClip(const SkISize& view_size,
const SkIRect& clip_area) = 0;
+ // Returns a reference to the shape of the most recently drawn buffer.
+ virtual const SkRegion* GetBufferShape() = 0;
+
protected:
virtual ~FrameProducer() {}
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 7bcc084..d772cfe 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -147,7 +147,7 @@ const char ChromotingInstance::kApiFeatures[] =
"asyncPin thirdPartyAuth pinlessAuth";
const char ChromotingInstance::kRequestedCapabilities[] = "";
-const char ChromotingInstance::kSupportedCapabilities[] = "";
+const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape";
bool ChromotingInstance::ParseAuthMethods(const std::string& auth_methods_str,
ClientConfig* config) {
@@ -469,6 +469,28 @@ void ChromotingInstance::SetDesktopSize(const SkISize& size,
PostChromotingMessage("onDesktopSize", data.Pass());
}
+void ChromotingInstance::SetDesktopShape(const SkRegion& shape) {
+ if (desktop_shape_ && shape == *desktop_shape_)
+ return;
+
+ desktop_shape_.reset(new SkRegion(shape));
+
+ scoped_ptr<base::ListValue> rects_value(new base::ListValue());
+ 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.x());
+ rect_value->AppendInteger(rect.y());
+ rect_value->AppendInteger(rect.width());
+ rect_value->AppendInteger(rect.height());
+ rects_value->Append(rect_value.release());
+ }
+
+ scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ data->Set("rects", rects_value.release());
+ PostChromotingMessage("onDesktopShape", data.Pass());
+}
+
void ChromotingInstance::OnConnectionState(
protocol::ConnectionToHost::State state,
protocol::ErrorCode error) {
diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h
index 40f470f..b98d922 100644
--- a/remoting/client/plugin/chromoting_instance.h
+++ b/remoting/client/plugin/chromoting_instance.h
@@ -18,6 +18,7 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/cpp/var.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"
// Windows defines 'PostMessage', so we have to undef it before we
@@ -135,6 +136,7 @@ class ChromotingInstance :
// Called by PepperView.
void SetDesktopSize(const SkISize& size, const SkIPoint& dpi);
+ void SetDesktopShape(const SkRegion& shape);
void OnFirstFrameReceived();
// Return statistics record by ChromotingClient.
@@ -233,6 +235,9 @@ class ChromotingInstance :
scoped_ptr<PepperView> view_;
pp::View plugin_view_;
+ // Contains the most-recently-reported desktop shape, if any.
+ scoped_ptr<SkRegion> desktop_shape_;
+
scoped_ptr<PepperSignalStrategy> signal_strategy_;
scoped_ptr<protocol::ConnectionToHost> host_connection_;
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc
index b2c8ac3..9f07a7d 100644
--- a/remoting/client/plugin/pepper_view.cc
+++ b/remoting/client/plugin/pepper_view.cc
@@ -104,7 +104,7 @@ void PepperView::SetView(const pp::View& view) {
// Create a 2D rendering context at the chosen frame dimensions.
pp::Size pp_size = pp::Size(view_size_.width(), view_size_.height());
- graphics2d_ = pp::Graphics2D(instance_, pp_size, true);
+ graphics2d_ = pp::Graphics2D(instance_, pp_size, false);
// Specify the scale from our coordinates to DIPs.
pp::Graphics2D_Dev graphics2d_dev(graphics2d_);
@@ -278,6 +278,11 @@ void PepperView::FlushBuffer(const SkIRect& clip_area,
&PepperView::OnFlushDone, AsWeakPtr(), start_time, buffer)));
CHECK(error == PP_OK_COMPLETIONPENDING);
flush_pending_ = true;
+
+ // If the buffer we just rendered has a shape then pass that to JavaScript.
+ const SkRegion* buffer_shape = producer_->GetBufferShape();
+ if (buffer_shape)
+ instance_->SetDesktopShape(*buffer_shape);
}
void PepperView::OnFlushDone(base::Time paint_start,
diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc
index 4f301ce..6c2f61b 100644
--- a/remoting/client/rectangle_update_decoder.cc
+++ b/remoting/client/rectangle_update_decoder.cc
@@ -222,6 +222,10 @@ void RectangleUpdateDecoder::SetOutputSizeAndClip(const SkISize& view_size,
}
}
+const SkRegion* RectangleUpdateDecoder::GetBufferShape() {
+ return decoder_->GetImageShape();
+}
+
void RectangleUpdateDecoder::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
const base::Closure& done) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h
index 5eefcad..fe71909 100644
--- a/remoting/client/rectangle_update_decoder.h
+++ b/remoting/client/rectangle_update_decoder.h
@@ -60,6 +60,7 @@ class RectangleUpdateDecoder
virtual void RequestReturnBuffers(const base::Closure& done) OVERRIDE;
virtual void SetOutputSizeAndClip(const SkISize& view_size,
const SkIRect& clip_area) OVERRIDE;
+ virtual const SkRegion* GetBufferShape() OVERRIDE;
// VideoStub implementation.
virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,