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 ASH_DISPLAY_DISPLAY_INFO_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_INFO_H_ |
6 #define ASH_DISPLAY_DISPLAY_INFO_H_ | 6 #define ASH_DISPLAY_DISPLAY_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "ui/gfx/display.h" | 12 #include "ui/gfx/display.h" |
13 #include "ui/gfx/insets.h" | 13 #include "ui/gfx/insets.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 // A struct that represents the display's resolution and | 19 // A struct that represents the display's resolution and |
20 // interlaced info. | 20 // interlaced info. |
21 struct ASH_EXPORT Resolution { | 21 struct ASH_EXPORT Resolution { |
oshima
2014/01/27 18:53:22
We probably should rename this to DisplayMode as i
sheu
2014/01/28 21:30:42
Done.
| |
22 Resolution(const gfx::Size& size, bool interlaced); | 22 Resolution(); |
23 Resolution(const gfx::Size& size, float refresh_rate, bool interlaced); | |
23 | 24 |
24 gfx::Size size; | 25 gfx::Size size; |
26 float refresh_rate; | |
25 bool interlaced; | 27 bool interlaced; |
26 }; | 28 }; |
27 | 29 |
28 // DisplayInfo contains metadata for each display. This is used to | 30 // DisplayInfo contains metadata for each display. This is used to |
29 // create |gfx::Display| as well as to maintain extra infomation | 31 // create |gfx::Display| as well as to maintain extra infomation |
30 // to manage displays in ash environment. | 32 // to manage displays in ash environment. |
31 // This class is intentionally made copiable. | 33 // This class is intentionally made copiable. |
32 class ASH_EXPORT DisplayInfo { | 34 class ASH_EXPORT DisplayInfo { |
33 public: | 35 public: |
34 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display | 36 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display |
35 // whose size is 1440x800 at the location (100, 200) in host coordinates. | 37 // whose size is 1440x800 at the location (100, 200) in host coordinates. |
36 // The format is | 38 // The format is |
37 // | 39 // |
38 // [origin-]widthxheight[*device_scale_factor][#resolutions list] | 40 // [origin-]widthxheight[*device_scale_factor][#resolutions list] |
39 // [/<properties>][@ui-scale] | 41 // [/<properties>][@ui-scale] |
40 // | 42 // |
41 // where [] are optional: | 43 // where [] are optional: |
42 // - |origin| is given in x+y- format. | 44 // - |origin| is given in x+y- format. |
43 // - |device_scale_factor| is either 2 or 1 (or empty). | 45 // - |device_scale_factor| is either 2 or 1 (or empty). |
44 // - properties can combination of 'o', which adds default overscan insets | 46 // - properties can combination of 'o', which adds default overscan insets |
45 // (5%), and one rotation property where 'r' is 90 degree clock-wise | 47 // (5%), and one rotation property where 'r' is 90 degree clock-wise |
46 // (to the 'r'ight) 'u' is 180 degrees ('u'pside-down) and 'l' is | 48 // (to the 'r'ight) 'u' is 180 degrees ('u'pside-down) and 'l' is |
47 // 270 degrees (to the 'l'eft). | 49 // 270 degrees (to the 'l'eft). |
48 // - ui-scale is floating value, e.g. @1.5 or @1.25. | 50 // - ui-scale is floating value, e.g. @1.5 or @1.25. |
49 // - |resolution list| is the list of size that is given in | 51 // - |resolution list| is the list of size that is given in |
50 // |width x height| separated by '|'. | 52 // |width x height [% refresh_rate]| separated by '|'. |
51 // | 53 // |
52 // A couple of examples: | 54 // A couple of examples: |
53 // "100x100" | 55 // "100x100" |
54 // 100x100 window at 0,0 origin. 1x device scale factor. no overscan. | 56 // 100x100 window at 0,0 origin. 1x device scale factor. no overscan. |
55 // no rotation. 1.0 ui scale. | 57 // no rotation. 1.0 ui scale. |
56 // "5+5-300x200*2" | 58 // "5+5-300x200*2" |
57 // 300x200 window at 5,5 origin. 2x device scale factor. | 59 // 300x200 window at 5,5 origin. 2x device scale factor. |
58 // no overscan, no rotation. 1.0 ui scale. | 60 // no overscan, no rotation. 1.0 ui scale. |
59 // "300x200/ol" | 61 // "300x200/ol" |
60 // 300x200 window at 0,0 origin. 1x device scale factor. | 62 // 300x200 window at 0,0 origin. 1x device scale factor. |
61 // with 5% overscan. rotated to left (90 degree counter clockwise). | 63 // with 5% overscan. rotated to left (90 degree counter clockwise). |
62 // 1.0 ui scale. | 64 // 1.0 ui scale. |
63 // "10+20-300x200/u@1.5" | 65 // "10+20-300x200/u@1.5" |
64 // 300x200 window at 10,20 origin. 1x device scale factor. | 66 // 300x200 window at 10,20 origin. 1x device scale factor. |
65 // no overscan. flipped upside-down (180 degree) and 1.5 ui scale. | 67 // no overscan. flipped upside-down (180 degree) and 1.5 ui scale. |
66 // "200x100#300x200|200x100|100x100" | 68 // "200x100#300x200|200x100%59.0|100x100%60" |
67 // 200x100 window at 0,0 origin, with 3 possible resolutions, | 69 // 200x100 window at 0,0 origin, with 3 possible resolutions, |
68 // 300x200, 200x100 and 100x100. | 70 // 300x200, 200x100 at 59 Hz, and 100x100 at 60 Hz. |
69 static DisplayInfo CreateFromSpec(const std::string& spec); | 71 static DisplayInfo CreateFromSpec(const std::string& spec); |
70 | 72 |
71 // Creates a DisplayInfo from string spec using given |id|. | 73 // Creates a DisplayInfo from string spec using given |id|. |
72 static DisplayInfo CreateFromSpecWithID(const std::string& spec, | 74 static DisplayInfo CreateFromSpecWithID(const std::string& spec, |
73 int64 id); | 75 int64 id); |
74 | 76 |
75 DisplayInfo(); | 77 DisplayInfo(); |
76 DisplayInfo(int64 id, const std::string& name, bool has_overscan); | 78 DisplayInfo(int64 id, const std::string& name, bool has_overscan); |
77 ~DisplayInfo(); | 79 ~DisplayInfo(); |
78 | 80 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 bool native_; | 191 bool native_; |
190 | 192 |
191 // The list of resolutions supported by this display. | 193 // The list of resolutions supported by this display. |
192 std::vector<Resolution> resolutions_; | 194 std::vector<Resolution> resolutions_; |
193 }; | 195 }; |
194 | 196 |
195 } // namespace internal | 197 } // namespace internal |
196 } // namespace ash | 198 } // namespace ash |
197 | 199 |
198 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ | 200 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ |
OLD | NEW |