Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: remoting/host/capturer_mac.cc

Issue 9705064: remoting: Move CGRectToSkIRect() to the only file where it's called (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | skia/ext/skia_utils_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <OpenGL/CGLMacro.h> 9 #include <OpenGL/CGLMacro.h>
10 #include <OpenGL/OpenGL.h> 10 #include <OpenGL/OpenGL.h>
11 #include <stddef.h> 11 #include <stddef.h>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/mac/scoped_cftyperef.h" 15 #include "base/mac/scoped_cftyperef.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "remoting/base/util.h" 18 #include "remoting/base/util.h"
19 #include "remoting/host/capturer_helper.h" 19 #include "remoting/host/capturer_helper.h"
20 #include "skia/ext/skia_utils_mac.h"
21 20
22 21
23 namespace remoting { 22 namespace remoting {
24 23
25 namespace { 24 namespace {
26 25
26 SkIRect CGRectToSkIRect(const CGRect& rect) {
27 SkIRect sk_rect = {
28 SkScalarRound(rect.origin.x),
29 SkScalarRound(rect.origin.y),
30 SkScalarRound(rect.origin.x + rect.size.width),
31 SkScalarRound(rect.origin.y + rect.size.height)
32 };
33 return sk_rect;
34 }
35
27 #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5) 36 #if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5)
28 // Possibly remove CapturerMac::CgBlitPreLion as well depending on performance 37 // Possibly remove CapturerMac::CgBlitPreLion as well depending on performance
29 // of CapturerMac::CgBlitPostLion on 10.6. 38 // of CapturerMac::CgBlitPostLion on 10.6.
30 #error No longer need to import CGDisplayCreateImage. 39 #error No longer need to import CGDisplayCreateImage.
31 #else 40 #else
32 // Declared here because CGDisplayCreateImage does not exist in the 10.5 SDK, 41 // Declared here because CGDisplayCreateImage does not exist in the 10.5 SDK,
33 // which we are currently compiling against, and it is required on 10.7 to do 42 // which we are currently compiling against, and it is required on 10.7 to do
34 // screen capture. 43 // screen capture.
35 typedef CGImageRef (*CGDisplayCreateImageFunc)(CGDirectDisplayID displayID); 44 typedef CGImageRef (*CGDisplayCreateImageFunc)(CGDirectDisplayID displayID);
36 #endif 45 #endif
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 557 }
549 } 558 }
550 559
551 const SkISize& CapturerMac::size_most_recent() const { 560 const SkISize& CapturerMac::size_most_recent() const {
552 return helper_.size_most_recent(); 561 return helper_.size_most_recent();
553 } 562 }
554 563
555 void CapturerMac::ScreenRefresh(CGRectCount count, const CGRect *rect_array) { 564 void CapturerMac::ScreenRefresh(CGRectCount count, const CGRect *rect_array) {
556 SkIRect skirect_array[count]; 565 SkIRect skirect_array[count];
557 for (CGRectCount i = 0; i < count; ++i) { 566 for (CGRectCount i = 0; i < count; ++i) {
558 skirect_array[i] = gfx::CGRectToSkIRect(rect_array[i]); 567 skirect_array[i] = CGRectToSkIRect(rect_array[i]);
559 } 568 }
560 SkRegion region; 569 SkRegion region;
561 region.setRects(skirect_array, count); 570 region.setRects(skirect_array, count);
562 InvalidateRegion(region); 571 InvalidateRegion(region);
563 } 572 }
564 573
565 void CapturerMac::ScreenUpdateMove(CGScreenUpdateMoveDelta delta, 574 void CapturerMac::ScreenUpdateMove(CGScreenUpdateMoveDelta delta,
566 size_t count, 575 size_t count,
567 const CGRect *rect_array) { 576 const CGRect *rect_array) {
568 SkIRect skirect_new_array[count]; 577 SkIRect skirect_new_array[count];
569 for (CGRectCount i = 0; i < count; ++i) { 578 for (CGRectCount i = 0; i < count; ++i) {
570 CGRect rect = rect_array[i]; 579 CGRect rect = rect_array[i];
571 rect = CGRectOffset(rect, delta.dX, delta.dY); 580 rect = CGRectOffset(rect, delta.dX, delta.dY);
572 skirect_new_array[i] = gfx::CGRectToSkIRect(rect); 581 skirect_new_array[i] = CGRectToSkIRect(rect);
573 } 582 }
574 SkRegion region; 583 SkRegion region;
575 region.setRects(skirect_new_array, count); 584 region.setRects(skirect_new_array, count);
576 InvalidateRegion(region); 585 InvalidateRegion(region);
577 } 586 }
578 587
579 void CapturerMac::DisplaysReconfigured(CGDirectDisplayID display, 588 void CapturerMac::DisplaysReconfigured(CGDirectDisplayID display,
580 CGDisplayChangeSummaryFlags flags) { 589 CGDisplayChangeSummaryFlags flags) {
581 if (display == CGMainDisplayID()) { 590 if (display == CGMainDisplayID()) {
582 if (flags & kCGDisplayBeginConfigurationFlag) { 591 if (flags & kCGDisplayBeginConfigurationFlag) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 Capturer* Capturer::Create() { 632 Capturer* Capturer::Create() {
624 CapturerMac* capturer = new CapturerMac(); 633 CapturerMac* capturer = new CapturerMac();
625 if (!capturer->Init()) { 634 if (!capturer->Init()) {
626 delete capturer; 635 delete capturer;
627 capturer = NULL; 636 capturer = NULL;
628 } 637 }
629 return capturer; 638 return capturer;
630 } 639 }
631 640
632 } // namespace remoting 641 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | skia/ext/skia_utils_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698