| 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_video_renderer_2d.h" | 5 #include "remoting/client/plugin/pepper_video_renderer_2d.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 | 153 |
| 154 | 154 |
| 155 if (size_changed || !source_dpi_.equals(frame->dpi())) { | 155 if (size_changed || !source_dpi_.equals(frame->dpi())) { |
| 156 source_dpi_ = frame->dpi(); | 156 source_dpi_ = frame->dpi(); |
| 157 | 157 |
| 158 // Notify JavaScript of the change in source size. | 158 // Notify JavaScript of the change in source size. |
| 159 event_handler_->OnVideoSize(source_size_, source_dpi_); | 159 event_handler_->OnVideoSize(source_size_, source_dpi_); |
| 160 } | 160 } |
| 161 | 161 |
| 162 const webrtc::DesktopRegion* shape = frame->shape(); | |
| 163 if (shape) { | |
| 164 if (!source_shape_ || !source_shape_->Equals(*shape)) { | |
| 165 source_shape_ = make_scoped_ptr(new webrtc::DesktopRegion(*shape)); | |
| 166 event_handler_->OnVideoShape(source_shape_.get()); | |
| 167 } | |
| 168 } else if (source_shape_) { | |
| 169 source_shape_ = nullptr; | |
| 170 event_handler_->OnVideoShape(nullptr); | |
| 171 } | |
| 172 | |
| 173 // If Debug dirty region is enabled then emit it. | 162 // If Debug dirty region is enabled then emit it. |
| 174 if (debug_dirty_region_) | 163 if (debug_dirty_region_) |
| 175 event_handler_->OnVideoFrameDirtyRegion(frame->updated_region()); | 164 event_handler_->OnVideoFrameDirtyRegion(frame->updated_region()); |
| 176 | 165 |
| 177 const pp::ImageData& image_data = | 166 const pp::ImageData& image_data = |
| 178 static_cast<PepperDesktopFrame*>(frame.get())->buffer(); | 167 static_cast<PepperDesktopFrame*>(frame.get())->buffer(); |
| 179 for (webrtc::DesktopRegion::Iterator i(frame->updated_region()); !i.IsAtEnd(); | 168 for (webrtc::DesktopRegion::Iterator i(frame->updated_region()); !i.IsAtEnd(); |
| 180 i.Advance()) { | 169 i.Advance()) { |
| 181 graphics2d_.PaintImageData(image_data, pp::Point(0, 0), | 170 graphics2d_.PaintImageData(image_data, pp::Point(0, 0), |
| 182 pp::Rect(i.rect().left(), i.rect().top(), | 171 pp::Rect(i.rect().left(), i.rect().top(), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 flush_pending_ = false; | 214 flush_pending_ = false; |
| 226 | 215 |
| 227 // Call all callbacks for the frames we've just flushed. | 216 // Call all callbacks for the frames we've just flushed. |
| 228 flushing_frames_done_callbacks_.clear(); | 217 flushing_frames_done_callbacks_.clear(); |
| 229 | 218 |
| 230 // Flush again if necessary. | 219 // Flush again if necessary. |
| 231 Flush(); | 220 Flush(); |
| 232 } | 221 } |
| 233 | 222 |
| 234 } // namespace remoting | 223 } // namespace remoting |
| OLD | NEW |