Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_3d.h" | 5 #include "remoting/client/plugin/pepper_video_renderer_3d.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 packet->format().y_dpi()); | 227 packet->format().y_dpi()); |
| 228 if (!frame_dpi_.equals(frame_dpi)) { | 228 if (!frame_dpi_.equals(frame_dpi)) { |
| 229 frame_dpi_ = frame_dpi; | 229 frame_dpi_ = frame_dpi; |
| 230 resolution_changed = true; | 230 resolution_changed = true; |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 | 233 |
| 234 if (resolution_changed) | 234 if (resolution_changed) |
| 235 event_handler_->OnVideoSize(frame_size_, frame_dpi_); | 235 event_handler_->OnVideoSize(frame_size_, frame_dpi_); |
| 236 | 236 |
| 237 // Update the desktop shape region. | 237 // Process the frame shape, if supplied |
|
Sergey Ulanov
2015/07/10 21:51:43
nit: add . at the end
Wez
2015/07/13 19:56:24
Done.
| |
| 238 webrtc::DesktopRegion desktop_shape; | |
| 239 if (packet->has_use_desktop_shape()) { | 238 if (packet->has_use_desktop_shape()) { |
| 240 for (int i = 0; i < packet->desktop_shape_rects_size(); ++i) { | 239 if (packet->use_desktop_shape()) { |
| 241 Rect remoting_rect = packet->desktop_shape_rects(i); | 240 webrtc::DesktopRegion shape; |
| 242 desktop_shape.AddRect(webrtc::DesktopRect::MakeXYWH( | 241 for (int i = 0; i < packet->desktop_shape_rects_size(); ++i) { |
| 243 remoting_rect.x(), remoting_rect.y(), | 242 Rect remoting_rect = packet->desktop_shape_rects(i); |
| 244 remoting_rect.width(), remoting_rect.height())); | 243 shape.AddRect(webrtc::DesktopRect::MakeXYWH( |
| 244 remoting_rect.x(), remoting_rect.y(), remoting_rect.width(), | |
| 245 remoting_rect.height())); | |
| 246 } | |
| 247 if (!frame_shape_) | |
| 248 frame_shape_ = make_scoped_ptr(new webrtc::DesktopRegion); | |
| 249 if (!frame_shape_->Equals(shape)) { | |
| 250 frame_shape_->Swap(&shape); | |
| 251 event_handler_->OnVideoShape(*frame_shape_); | |
| 252 } | |
| 253 } else if (frame_shape_) { | |
| 254 frame_shape_.reset(); | |
|
Sergey Ulanov
2015/07/10 21:51:43
nit: You are using frame_shape_ = make_scoped_ptr(
Wez
2015/07/13 19:56:24
Done.
| |
| 255 event_handler_->OnVideoShape( | |
| 256 webrtc::DesktopRegion(webrtc::DesktopRect::MakeSize(frame_size_))); | |
| 245 } | 257 } |
| 246 } else { | |
| 247 // Fallback for the case when the host didn't include the desktop shape. | |
| 248 desktop_shape = | |
| 249 webrtc::DesktopRegion(webrtc::DesktopRect::MakeSize(frame_size_)); | |
| 250 } | |
| 251 | |
| 252 if (!desktop_shape_.Equals(desktop_shape)) { | |
| 253 desktop_shape_.Swap(&desktop_shape); | |
| 254 event_handler_->OnVideoShape(desktop_shape_); | |
| 255 } | 258 } |
| 256 | 259 |
| 257 // Report the dirty region, for debugging, if requested. | 260 // Report the dirty region, for debugging, if requested. |
| 258 if (debug_dirty_region_) { | 261 if (debug_dirty_region_) { |
| 259 webrtc::DesktopRegion dirty_region; | 262 webrtc::DesktopRegion dirty_region; |
| 260 for (int i = 0; i < packet->dirty_rects_size(); ++i) { | 263 for (int i = 0; i < packet->dirty_rects_size(); ++i) { |
| 261 Rect remoting_rect = packet->dirty_rects(i); | 264 Rect remoting_rect = packet->dirty_rects(i); |
| 262 dirty_region.AddRect(webrtc::DesktopRect::MakeXYWH( | 265 dirty_region.AddRect(webrtc::DesktopRect::MakeXYWH( |
| 263 remoting_rect.x(), remoting_rect.y(), | 266 remoting_rect.x(), remoting_rect.y(), |
| 264 remoting_rect.width(), remoting_rect.height())); | 267 remoting_rect.width(), remoting_rect.height())); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); | 533 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); |
| 531 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); | 534 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); |
| 532 } | 535 } |
| 533 | 536 |
| 534 void PepperVideoRenderer3D::CheckGLError() { | 537 void PepperVideoRenderer3D::CheckGLError() { |
| 535 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); | 538 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); |
| 536 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; | 539 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; |
| 537 } | 540 } |
| 538 | 541 |
| 539 } // namespace remoting | 542 } // namespace remoting |
| OLD | NEW |