Chromium Code Reviews| 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 CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ | 5 #ifndef CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ |
| 6 #define CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ | 6 #define CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
| 12 | 12 |
| 13 // Forward declarations for Xlib and Xrandr. | 13 // Forward declarations for Xlib and Xrandr. |
| 14 // This is so unused X definitions don't pollute the namespace. | 14 // This is so unused X definitions don't pollute the namespace. |
| 15 typedef unsigned long XID; | 15 typedef unsigned long XID; |
| 16 typedef XID RRMode; | |
| 17 struct _XRRModeInfo; | |
| 18 typedef _XRRModeInfo XRRModeInfo; | |
| 19 struct _XRRScreenResources; | |
| 20 typedef _XRRScreenResources XRRScreenResources; | |
| 21 struct _XRROutputInfo; | |
| 22 typedef _XRROutputInfo XRROutputInfo; | |
| 16 | 23 |
| 17 namespace chromeos { | 24 namespace chromeos { |
| 18 | 25 |
| 19 // Gets the EDID data from |output| and generates the display id through | 26 // Gets the EDID data from |output| and generates the display id through |
| 20 // |GetDisplayIdFromEDID|. | 27 // |GetDisplayIdFromEDID|. |
| 21 CHROMEOS_EXPORT bool GetDisplayId(XID output, size_t index, | 28 CHROMEOS_EXPORT bool GetDisplayId(XID output, size_t index, |
| 22 int64* display_id_out); | 29 int64* display_id_out); |
| 23 | 30 |
| 24 // Generates the display id for the pair of |prop| with |nitems| length and | 31 // Generates the display id for the pair of |prop| with |nitems| length and |
| 25 // |index|, and store in |display_id_out|. Returns true if the display id is | 32 // |index|, and store in |display_id_out|. Returns true if the display id is |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 50 | 57 |
| 51 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns | 58 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns |
| 52 // true if the flag is found. This is exported for x11_util_unittest.cc. | 59 // true if the flag is found. This is exported for x11_util_unittest.cc. |
| 53 CHROMEOS_EXPORT bool ParseOutputOverscanFlag(const unsigned char* prop, | 60 CHROMEOS_EXPORT bool ParseOutputOverscanFlag(const unsigned char* prop, |
| 54 unsigned long nitems, | 61 unsigned long nitems, |
| 55 bool* flag); | 62 bool* flag); |
| 56 | 63 |
| 57 // Returns true if an output named |name| is an internal display. | 64 // Returns true if an output named |name| is an internal display. |
| 58 CHROMEOS_EXPORT bool IsInternalOutputName(const std::string& name); | 65 CHROMEOS_EXPORT bool IsInternalOutputName(const std::string& name); |
| 59 | 66 |
| 67 // Find a XRRModeInfo that matches |mode|. | |
| 68 CHROMEOS_EXPORT const XRRModeInfo* FindModeInfo( | |
| 69 const XRRScreenResources* screen_resources, | |
| 70 XID mode); | |
| 71 | |
| 72 // Find a mode that matches the given size with highest reflesh | |
|
Daniel Erat
2013/07/31 17:34:05
nit: s/reflesh/refresh/
oshima
2013/07/31 21:59:49
Done.
| |
| 73 // rate. Non interlaced mode takes precedence, so non interlaced mode | |
|
Daniel Erat
2013/07/31 17:34:05
nit:
Non-interlaced modes take precedence, so a n
oshima
2013/07/31 21:59:49
Done.
| |
| 74 // with lower refresh rate will be used even if there is an interlaced | |
| 75 // mode with higher refresh rate. | |
| 76 CHROMEOS_EXPORT RRMode FindOutputModeMatchingSize( | |
| 77 const XRRScreenResources* screen_resources, | |
| 78 const XRROutputInfo* output_info, | |
| 79 size_t width, | |
| 80 size_t height); | |
| 81 | |
| 82 namespace test { | |
| 83 | |
| 84 // Creates XRRModeInfo for unit tests. | |
| 85 CHROMEOS_EXPORT XRRModeInfo CreateModeInfo(int id, | |
| 86 int width, | |
| 87 int height, | |
| 88 bool interlaced, | |
| 89 float refresh_rate); | |
| 90 | |
| 91 } // namespace test | |
| 92 | |
| 60 } // namespace chromeos | 93 } // namespace chromeos |
| 61 | 94 |
| 62 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ | 95 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ |
| OLD | NEW |