| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/media/capture/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
| 11 #include "cc/output/copy_output_result.h" | 11 #include "cc/output/copy_output_result.h" |
| 12 #include "content/browser/compositor/image_transport_factory.h" | 12 #include "content/browser/compositor/image_transport_factory.h" |
| 13 #include "content/browser/media/capture/content_video_capture_device_core.h" | 13 #include "content/browser/media/capture/content_video_capture_device_core.h" |
| 14 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" | 14 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
| 15 #include "content/common/gpu/client/gl_helper.h" | 15 #include "content/common/gpu/client/gl_helper.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "media/base/bind_to_current_loop.h" | 17 #include "media/base/bind_to_current_loop.h" |
| 18 #include "media/base/video_util.h" | 18 #include "media/base/video_util.h" |
| 19 #include "media/video/capture/video_capture_types.h" | 19 #include "media/video/capture/video_capture_types.h" |
| 20 #include "skia/ext/image_operations.h" | 20 #include "skia/ext/image_operations.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 22 #include "ui/aura/client/screen_position_client.h" |
| 22 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
| 23 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 24 #include "ui/aura/window_observer.h" | 25 #include "ui/aura/window_observer.h" |
| 25 #include "ui/aura/window_tree_host.h" | 26 #include "ui/aura/window_tree_host.h" |
| 26 #include "ui/base/cursor/cursors_aura.h" | 27 #include "ui/base/cursor/cursors_aura.h" |
| 27 #include "ui/compositor/compositor.h" | 28 #include "ui/compositor/compositor.h" |
| 28 #include "ui/compositor/dip_util.h" | 29 #include "ui/compositor/dip_util.h" |
| 29 #include "ui/compositor/layer.h" | 30 #include "ui/compositor/layer.h" |
| 30 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
| 31 | 32 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 desktop_bounds.height()); | 452 desktop_bounds.height()); |
| 452 last_cursor_ = cursor; | 453 last_cursor_ = cursor; |
| 453 } else { | 454 } else { |
| 454 // Clear cursor state if ui::GetCursorBitmap failed so that we do not | 455 // Clear cursor state if ui::GetCursorBitmap failed so that we do not |
| 455 // render cursor on the captured frame. | 456 // render cursor on the captured frame. |
| 456 ClearCursorState(); | 457 ClearCursorState(); |
| 457 } | 458 } |
| 458 } | 459 } |
| 459 | 460 |
| 460 gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location(); | 461 gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location(); |
| 462 aura::client::GetScreenPositionClient(desktop_window_->GetRootWindow())-> |
| 463 ConvertPointFromScreen(desktop_window_, &cursor_position); |
| 461 const gfx::Point hot_point_in_dip = ui::ConvertPointToDIP( | 464 const gfx::Point hot_point_in_dip = ui::ConvertPointToDIP( |
| 462 desktop_layer_, cursor_hot_point_); | 465 desktop_layer_, cursor_hot_point_); |
| 463 cursor_position.Offset(-desktop_bounds.x() - hot_point_in_dip.x(), | 466 cursor_position.Offset(-desktop_bounds.x() - hot_point_in_dip.x(), |
| 464 -desktop_bounds.y() - hot_point_in_dip.y()); | 467 -desktop_bounds.y() - hot_point_in_dip.y()); |
| 465 return gfx::Point( | 468 return gfx::Point( |
| 466 region_in_frame.x() + cursor_position.x() * region_in_frame.width() / | 469 region_in_frame.x() + cursor_position.x() * region_in_frame.width() / |
| 467 desktop_bounds.width(), | 470 desktop_bounds.width(), |
| 468 region_in_frame.y() + cursor_position.y() * region_in_frame.height() / | 471 region_in_frame.y() + cursor_position.y() * region_in_frame.height() / |
| 469 desktop_bounds.height()); | 472 desktop_bounds.height()); |
| 470 } | 473 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 scoped_ptr<Client> client) { | 528 scoped_ptr<Client> client) { |
| 526 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 529 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
| 527 core_->AllocateAndStart(params, client.Pass()); | 530 core_->AllocateAndStart(params, client.Pass()); |
| 528 } | 531 } |
| 529 | 532 |
| 530 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 533 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
| 531 core_->StopAndDeAllocate(); | 534 core_->StopAndDeAllocate(); |
| 532 } | 535 } |
| 533 | 536 |
| 534 } // namespace content | 537 } // namespace content |
| OLD | NEW |