OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/client/plugin/pepper_view.h" | 5 #include "remoting/client/plugin/pepper_view.h" |
6 | 6 |
7 #include <functional> | 7 #include <functional> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ClientContext* context, | 70 ClientContext* context, |
71 FrameProducer* producer) | 71 FrameProducer* producer) |
72 : instance_(instance), | 72 : instance_(instance), |
73 context_(context), | 73 context_(context), |
74 producer_(producer), | 74 producer_(producer), |
75 merge_buffer_(NULL), | 75 merge_buffer_(NULL), |
76 merge_clip_area_(SkIRect::MakeEmpty()), | 76 merge_clip_area_(SkIRect::MakeEmpty()), |
77 view_size_(SkISize::Make(0, 0)), | 77 view_size_(SkISize::Make(0, 0)), |
78 clip_area_(SkIRect::MakeEmpty()), | 78 clip_area_(SkIRect::MakeEmpty()), |
79 source_size_(SkISize::Make(0, 0)), | 79 source_size_(SkISize::Make(0, 0)), |
| 80 source_dpi_(SkIPoint::Make(0, 0)), |
80 flush_pending_(false), | 81 flush_pending_(false), |
81 is_initialized_(false), | 82 is_initialized_(false), |
82 frame_received_(false) { | 83 frame_received_(false) { |
83 } | 84 } |
84 | 85 |
85 PepperView::~PepperView() { | 86 PepperView::~PepperView() { |
86 DCHECK(merge_buffer_ == NULL); | 87 DCHECK(merge_buffer_ == NULL); |
87 DCHECK(buffers_.empty()); | 88 DCHECK(buffers_.empty()); |
88 } | 89 } |
89 | 90 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // and allocate a new one. | 221 // and allocate a new one. |
221 if (buffer->size().width() >= clip_area_.width() && | 222 if (buffer->size().width() >= clip_area_.width() && |
222 buffer->size().height() >= clip_area_.height()) { | 223 buffer->size().height() >= clip_area_.height()) { |
223 producer_->DrawBuffer(buffer); | 224 producer_->DrawBuffer(buffer); |
224 } else { | 225 } else { |
225 FreeBuffer(buffer); | 226 FreeBuffer(buffer); |
226 InitiateDrawing(); | 227 InitiateDrawing(); |
227 } | 228 } |
228 } | 229 } |
229 | 230 |
230 void PepperView::SetSourceSize(const SkISize& source_size) { | 231 void PepperView::SetSourceSize(const SkISize& source_size, |
| 232 const SkIPoint& source_dpi) { |
231 DCHECK(context_->main_task_runner()->BelongsToCurrentThread()); | 233 DCHECK(context_->main_task_runner()->BelongsToCurrentThread()); |
232 | 234 |
233 if (source_size_ == source_size) | 235 if (source_size_ == source_size && source_dpi_ == source_dpi) |
234 return; | 236 return; |
235 | 237 |
236 source_size_ = source_size; | 238 source_size_ = source_size; |
| 239 source_dpi_ = source_dpi; |
237 | 240 |
238 // Notify JavaScript of the change in source size. | 241 // Notify JavaScript of the change in source size. |
239 instance_->SetDesktopSize(source_size.width(), source_size.height()); | 242 instance_->SetDesktopSize(source_size, source_dpi); |
240 } | 243 } |
241 | 244 |
242 pp::ImageData* PepperView::AllocateBuffer() { | 245 pp::ImageData* PepperView::AllocateBuffer() { |
243 if (buffers_.size() >= kMaxPendingBuffersCount) | 246 if (buffers_.size() >= kMaxPendingBuffersCount) |
244 return NULL; | 247 return NULL; |
245 | 248 |
246 pp::Size pp_size = pp::Size(clip_area_.width(), clip_area_.height()); | 249 pp::Size pp_size = pp::Size(clip_area_.width(), clip_area_.height()); |
247 if (pp_size.IsEmpty()) | 250 if (pp_size.IsEmpty()) |
248 return NULL; | 251 return NULL; |
249 | 252 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 351 |
349 // If there is a buffer queued for rendering then render it now. | 352 // If there is a buffer queued for rendering then render it now. |
350 if (merge_buffer_ != NULL) { | 353 if (merge_buffer_ != NULL) { |
351 buffer = merge_buffer_; | 354 buffer = merge_buffer_; |
352 merge_buffer_ = NULL; | 355 merge_buffer_ = NULL; |
353 FlushBuffer(merge_clip_area_, buffer, merge_region_); | 356 FlushBuffer(merge_clip_area_, buffer, merge_region_); |
354 } | 357 } |
355 } | 358 } |
356 | 359 |
357 } // namespace remoting | 360 } // namespace remoting |
OLD | NEW |