| 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/host/capturer.h" | 5 #include "remoting/host/capturer.h" |
| 6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <IOKit/pwr_mgt/IOPMLib.h> | 9 #include <IOKit/pwr_mgt/IOPMLib.h> |
| 10 #include <OpenGL/CGLMacro.h> | 10 #include <OpenGL/CGLMacro.h> |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 class CapturerMac : public Capturer { | 153 class CapturerMac : public Capturer { |
| 154 public: | 154 public: |
| 155 CapturerMac(); | 155 CapturerMac(); |
| 156 virtual ~CapturerMac(); | 156 virtual ~CapturerMac(); |
| 157 | 157 |
| 158 bool Init(); | 158 bool Init(); |
| 159 | 159 |
| 160 // Capturer interface. | 160 // Capturer interface. |
| 161 virtual void Start() OVERRIDE; | 161 virtual void Start() OVERRIDE; |
| 162 virtual void Stop() OVERRIDE; | 162 virtual void Stop() OVERRIDE; |
| 163 virtual void SetCursorShapeChangedCallback( |
| 164 const CursorShapeChangedCallback& callback) OVERRIDE; |
| 163 virtual void ScreenConfigurationChanged() OVERRIDE; | 165 virtual void ScreenConfigurationChanged() OVERRIDE; |
| 164 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; | 166 virtual media::VideoFrame::Format pixel_format() const OVERRIDE; |
| 165 virtual void ClearInvalidRegion() OVERRIDE; | 167 virtual void ClearInvalidRegion() OVERRIDE; |
| 166 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; | 168 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; |
| 167 virtual void InvalidateScreen(const SkISize& size) OVERRIDE; | 169 virtual void InvalidateScreen(const SkISize& size) OVERRIDE; |
| 168 virtual void InvalidateFullScreen() OVERRIDE; | 170 virtual void InvalidateFullScreen() OVERRIDE; |
| 169 virtual void CaptureInvalidRegion( | 171 virtual void CaptureInvalidRegion( |
| 170 const CaptureCompletedCallback& callback) OVERRIDE; | 172 const CaptureCompletedCallback& callback) OVERRIDE; |
| 171 virtual const SkISize& size_most_recent() const OVERRIDE; | 173 virtual const SkISize& size_most_recent() const OVERRIDE; |
| 172 | 174 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 &power_assertion_id_); | 312 &power_assertion_id_); |
| 311 } | 313 } |
| 312 | 314 |
| 313 void CapturerMac::Stop() { | 315 void CapturerMac::Stop() { |
| 314 if (power_assertion_id_ != kIOPMNullAssertionID) { | 316 if (power_assertion_id_ != kIOPMNullAssertionID) { |
| 315 IOPMAssertionRelease(power_assertion_id_); | 317 IOPMAssertionRelease(power_assertion_id_); |
| 316 power_assertion_id_ = kIOPMNullAssertionID; | 318 power_assertion_id_ = kIOPMNullAssertionID; |
| 317 } | 319 } |
| 318 } | 320 } |
| 319 | 321 |
| 322 void CapturerMac::SetCursorShapeChangedCallback( |
| 323 const CursorShapeChangedCallback& callback) { |
| 324 // TODO(garykac) |
| 325 } |
| 326 |
| 320 void CapturerMac::ScreenConfigurationChanged() { | 327 void CapturerMac::ScreenConfigurationChanged() { |
| 321 ReleaseBuffers(); | 328 ReleaseBuffers(); |
| 322 helper_.ClearInvalidRegion(); | 329 helper_.ClearInvalidRegion(); |
| 323 last_buffer_ = NULL; | 330 last_buffer_ = NULL; |
| 324 | 331 |
| 325 CGDirectDisplayID mainDevice = CGMainDisplayID(); | 332 CGDirectDisplayID mainDevice = CGMainDisplayID(); |
| 326 int width = CGDisplayPixelsWide(mainDevice); | 333 int width = CGDisplayPixelsWide(mainDevice); |
| 327 int height = CGDisplayPixelsHigh(mainDevice); | 334 int height = CGDisplayPixelsHigh(mainDevice); |
| 328 InvalidateScreen(SkISize::Make(width, height)); | 335 InvalidateScreen(SkISize::Make(width, height)); |
| 329 | 336 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 Capturer* Capturer::Create() { | 663 Capturer* Capturer::Create() { |
| 657 CapturerMac* capturer = new CapturerMac(); | 664 CapturerMac* capturer = new CapturerMac(); |
| 658 if (!capturer->Init()) { | 665 if (!capturer->Init()) { |
| 659 delete capturer; | 666 delete capturer; |
| 660 capturer = NULL; | 667 capturer = NULL; |
| 661 } | 668 } |
| 662 return capturer; | 669 return capturer; |
| 663 } | 670 } |
| 664 | 671 |
| 665 } // namespace remoting | 672 } // namespace remoting |
| OLD | NEW |