OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_ |
6 #define MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_ | 6 #define MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_ |
7 | 7 |
8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
9 #include <Carbon/Carbon.h> | 9 #include <Carbon/Carbon.h> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
14 #include "third_party/skia/include/core/SkPoint.h" | 14 #include "third_party/skia/include/core/SkPoint.h" |
15 #include "third_party/skia/include/core/SkRect.h" | 15 #include "third_party/skia/include/core/SkRect.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 // Describes the configuration of a specific display. | 19 // Describes the configuration of a specific display. |
20 struct MEDIA_EXPORT MacDisplayConfiguration { | 20 struct MEDIA_EXPORT MacDisplayConfiguration { |
21 MacDisplayConfiguration(); | 21 MacDisplayConfiguration(); |
22 | 22 |
23 // Returns the current configuration of the specified display. | |
24 MEDIA_EXPORT static MacDisplayConfiguration ForDisplay( | |
25 CGDirectDisplayID display_id); | |
26 | |
27 // Cocoa identifier for this display. | 23 // Cocoa identifier for this display. |
28 CGDirectDisplayID id; | 24 CGDirectDisplayID id; |
29 | 25 |
30 // Bounds of this display in Density-Independent Pixels (DIPs). | 26 // Bounds of this display in Density-Independent Pixels (DIPs). |
31 SkIRect bounds; | 27 SkIRect bounds; |
32 | 28 |
33 // Bounds of this display in physical pixels. | 29 // Bounds of this display in physical pixels. |
34 SkIRect pixel_bounds; | 30 SkIRect pixel_bounds; |
35 | 31 |
36 // Scale factor from DIPs to physical pixels. | 32 // Scale factor from DIPs to physical pixels. |
37 float dip_to_pixel_scale; | 33 float dip_to_pixel_scale; |
38 }; | 34 }; |
39 | 35 |
40 typedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations; | 36 typedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations; |
41 | 37 |
42 // Describes the configuration of the whole desktop. | 38 // Describes the configuration of the whole desktop. |
43 struct MEDIA_EXPORT MacDesktopConfiguration { | 39 struct MEDIA_EXPORT MacDesktopConfiguration { |
| 40 // Used to request bottom-up or top-down coordinates. |
| 41 enum Origin { BottomLeftOrigin, TopLeftOrigin }; |
| 42 |
44 MacDesktopConfiguration(); | 43 MacDesktopConfiguration(); |
45 ~MacDesktopConfiguration(); | 44 ~MacDesktopConfiguration(); |
46 | 45 |
47 // Returns the current configuration of the desktop. | 46 // Returns the desktop & display configurations in Cocoa-style "bottom-up" |
48 MEDIA_EXPORT static MacDesktopConfiguration GetCurrent(); | 47 // (the origin is the bottom-left of the primary monitor, and coordinates |
| 48 // increase as you move up the screen) or Carbon-style "top-down" coordinates. |
| 49 MEDIA_EXPORT static MacDesktopConfiguration GetCurrent(Origin origin); |
49 | 50 |
50 // Bounds of the desktop in Density-Independent Pixels (DIPs). | 51 // Bounds of the desktop in Density-Independent Pixels (DIPs). |
51 SkIRect bounds; | 52 SkIRect bounds; |
52 | 53 |
53 // Bounds of the desktop in physical pixels. | 54 // Bounds of the desktop in physical pixels. |
54 SkIRect pixel_bounds; | 55 SkIRect pixel_bounds; |
55 | 56 |
56 // Scale factor from DIPs to physical pixels. | 57 // Scale factor from DIPs to physical pixels. |
57 float dip_to_pixel_scale; | 58 float dip_to_pixel_scale; |
58 | 59 |
59 // Configurations of the displays making up the desktop area. | 60 // Configurations of the displays making up the desktop area. |
60 MacDisplayConfigurations displays; | 61 MacDisplayConfigurations displays; |
61 }; | 62 }; |
62 | 63 |
63 } // namespace media | 64 } // namespace media |
64 | 65 |
65 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_ | 66 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_MAC_DESKTOP_CONFIGURATION_H_ |
OLD | NEW |