Index: trunk/src/remoting/client/rectangle_update_decoder.cc |
=================================================================== |
--- trunk/src/remoting/client/rectangle_update_decoder.cc (revision 224204) |
+++ trunk/src/remoting/client/rectangle_update_decoder.cc (working copy) |
@@ -31,6 +31,10 @@ |
: main_task_runner_(main_task_runner), |
decode_task_runner_(decode_task_runner), |
consumer_(consumer), |
+ source_size_(SkISize::Make(0, 0)), |
+ source_dpi_(SkIPoint::Make(0, 0)), |
+ view_size_(SkISize::Make(0, 0)), |
+ clip_area_(SkIRect::MakeEmpty()), |
paint_scheduled_(false), |
latest_sequence_number_(0) { |
} |
@@ -62,25 +66,25 @@ |
// If the packet includes screen size or DPI information, store them. |
if (packet->format().has_screen_width() && |
packet->format().has_screen_height()) { |
- webrtc::DesktopSize source_size(packet->format().screen_width(), |
- packet->format().screen_height()); |
- if (!source_size_.equals(source_size)) { |
+ SkISize source_size = SkISize::Make(packet->format().screen_width(), |
+ packet->format().screen_height()); |
+ if (source_size_ != source_size) { |
source_size_ = source_size; |
decoder_needs_reset = true; |
notify_size_or_dpi_change = true; |
} |
} |
if (packet->format().has_x_dpi() && packet->format().has_y_dpi()) { |
- webrtc::DesktopVector source_dpi(packet->format().x_dpi(), |
- packet->format().y_dpi()); |
- if (!source_dpi.equals(source_dpi_)) { |
+ SkIPoint source_dpi(SkIPoint::Make(packet->format().x_dpi(), |
+ packet->format().y_dpi())); |
+ if (source_dpi != source_dpi_) { |
source_dpi_ = source_dpi; |
notify_size_or_dpi_change = true; |
} |
} |
// If we've never seen a screen size, ignore the packet. |
- if (source_size_.is_empty()) |
+ if (source_size_.isZero()) |
return; |
if (decoder_needs_reset) |
@@ -111,23 +115,23 @@ |
paint_scheduled_ = false; |
// If the view size is empty or we have no output buffers ready, return. |
- if (buffers_.empty() || view_size_.is_empty()) |
+ if (buffers_.empty() || view_size_.isEmpty()) |
return; |
// If no Decoder is initialized, or the host dimensions are empty, return. |
- if (!decoder_.get() || source_size_.is_empty()) |
+ if (!decoder_.get() || source_size_.isEmpty()) |
return; |
// Draw the invalidated region to the buffer. |
webrtc::DesktopFrame* buffer = buffers_.front(); |
- webrtc::DesktopRegion output_region; |
+ SkRegion output_region; |
decoder_->RenderFrame(view_size_, clip_area_, |
buffer->data(), |
buffer->stride(), |
&output_region); |
// Notify the consumer that painting is done. |
- if (!output_region.is_empty()) { |
+ if (!output_region.isEmpty()) { |
buffers_.pop_front(); |
consumer_->ApplyBuffer(view_size_, clip_area_, buffer, output_region); |
} |
@@ -165,8 +169,7 @@ |
SchedulePaint(); |
} |
-void RectangleUpdateDecoder::InvalidateRegion( |
- const webrtc::DesktopRegion& region) { |
+void RectangleUpdateDecoder::InvalidateRegion(const SkRegion& region) { |
if (!decode_task_runner_->BelongsToCurrentThread()) { |
decode_task_runner_->PostTask( |
FROM_HERE, base::Bind(&RectangleUpdateDecoder::InvalidateRegion, |
@@ -180,9 +183,8 @@ |
} |
} |
-void RectangleUpdateDecoder::SetOutputSizeAndClip( |
- const webrtc::DesktopSize& view_size, |
- const webrtc::DesktopRect& clip_area) { |
+void RectangleUpdateDecoder::SetOutputSizeAndClip(const SkISize& view_size, |
+ const SkIRect& clip_area) { |
if (!decode_task_runner_->BelongsToCurrentThread()) { |
decode_task_runner_->PostTask( |
FROM_HERE, base::Bind(&RectangleUpdateDecoder::SetOutputSizeAndClip, |
@@ -191,14 +193,14 @@ |
} |
// The whole frame needs to be repainted if the scaling factor has changed. |
- if (!view_size_.equals(view_size) && decoder_.get()) { |
- webrtc::DesktopRegion region; |
- region.AddRect(webrtc::DesktopRect::MakeSize(view_size)); |
+ if (view_size_ != view_size && decoder_.get()) { |
+ SkRegion region; |
+ region.op(SkIRect::MakeSize(view_size), SkRegion::kUnion_Op); |
decoder_->Invalidate(view_size, region); |
} |
- if (!view_size_.equals(view_size) || |
- !clip_area_.equals(clip_area)) { |
+ if (view_size_ != view_size || |
+ clip_area_ != clip_area) { |
view_size_ = view_size; |
clip_area_ = clip_area; |
@@ -219,7 +221,7 @@ |
} |
} |
-const webrtc::DesktopRegion* RectangleUpdateDecoder::GetBufferShape() { |
+const SkRegion* RectangleUpdateDecoder::GetBufferShape() { |
return decoder_->GetImageShape(); |
} |