| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ | 5 #ifndef UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ |
| 6 #define UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ | 6 #define UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ui/display/types/display_constants.h" | 10 #include "ui/display/types/display_constants.h" |
| 11 #include "ui/display/types/display_mode.h" | 11 #include "ui/display/types/display_mode.h" |
| 12 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
| 13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 // This class represents the state of a display at one point in time. Platforms | 17 // This class represents the state of a display at one point in time. Platforms |
| 18 // will extend this class in order to add platform specific configuration and | 18 // will extend this class in order to add platform specific configuration and |
| 19 // identifiers required to configure this display. | 19 // identifiers required to configure this display. |
| 20 class DISPLAY_TYPES_EXPORT DisplaySnapshot { | 20 class DISPLAY_TYPES_EXPORT DisplaySnapshot { |
| 21 public: | 21 public: |
| 22 DisplaySnapshot(int64_t display_id, | 22 DisplaySnapshot(int64_t display_id, |
| 23 const gfx::Point& origin, | 23 const gfx::Point& origin, |
| 24 const gfx::Size& physical_size, | 24 const gfx::Size& physical_size, |
| 25 DisplayConnectionType type, | 25 DisplayConnectionType type, |
| 26 bool is_aspect_preserving_scaling, | 26 bool is_aspect_preserving_scaling, |
| 27 bool has_overscan, | 27 bool has_overscan, |
| 28 bool has_color_correction_matrix, |
| 28 std::string display_name, | 29 std::string display_name, |
| 29 const std::vector<const DisplayMode*>& modes, | 30 const std::vector<const DisplayMode*>& modes, |
| 30 const DisplayMode* current_mode, | 31 const DisplayMode* current_mode, |
| 31 const DisplayMode* native_mode); | 32 const DisplayMode* native_mode); |
| 32 virtual ~DisplaySnapshot(); | 33 virtual ~DisplaySnapshot(); |
| 33 | 34 |
| 34 const gfx::Point& origin() const { return origin_; } | 35 const gfx::Point& origin() const { return origin_; } |
| 35 const gfx::Size& physical_size() const { return physical_size_; } | 36 const gfx::Size& physical_size() const { return physical_size_; } |
| 36 ui::DisplayConnectionType type() const { return type_; } | 37 ui::DisplayConnectionType type() const { return type_; } |
| 37 bool is_aspect_preserving_scaling() const { | 38 bool is_aspect_preserving_scaling() const { |
| 38 return is_aspect_preserving_scaling_; | 39 return is_aspect_preserving_scaling_; |
| 39 } | 40 } |
| 40 bool has_overscan() const { return has_overscan_; } | 41 bool has_overscan() const { return has_overscan_; } |
| 41 std::string display_name() const { return display_name_; } | 42 std::string display_name() const { return display_name_; } |
| 42 | 43 |
| 43 int64_t display_id() const { return display_id_; } | 44 int64_t display_id() const { return display_id_; } |
| 44 | 45 |
| 45 const DisplayMode* current_mode() const { return current_mode_; } | 46 const DisplayMode* current_mode() const { return current_mode_; } |
| 46 const DisplayMode* native_mode() const { return native_mode_; } | 47 const DisplayMode* native_mode() const { return native_mode_; } |
| 47 int64_t product_id() const { return product_id_; } | 48 int64_t product_id() const { return product_id_; } |
| 48 | 49 |
| 49 const std::vector<const DisplayMode*>& modes() const { return modes_; } | 50 const std::vector<const DisplayMode*>& modes() const { return modes_; } |
| 50 | 51 |
| 51 void set_current_mode(const DisplayMode* mode) { current_mode_ = mode; } | 52 void set_current_mode(const DisplayMode* mode) { current_mode_ = mode; } |
| 52 void set_origin(const gfx::Point& origin) { origin_ = origin; } | 53 void set_origin(const gfx::Point& origin) { origin_ = origin; } |
| 53 void add_mode(const DisplayMode* mode) { modes_.push_back(mode); } | 54 void add_mode(const DisplayMode* mode) { modes_.push_back(mode); } |
| 54 | 55 |
| 56 // Whether this display has advanced color correction available. |
| 57 bool has_color_correction_matrix() const { |
| 58 return has_color_correction_matrix_; |
| 59 } |
| 60 |
| 55 // Returns a textual representation of this display state. | 61 // Returns a textual representation of this display state. |
| 56 virtual std::string ToString() const = 0; | 62 virtual std::string ToString() const = 0; |
| 57 | 63 |
| 58 // Used when no product id known. | 64 // Used when no product id known. |
| 59 static const int64_t kInvalidProductID = -1; | 65 static const int64_t kInvalidProductID = -1; |
| 60 | 66 |
| 61 protected: | 67 protected: |
| 62 // Display id for this output. | 68 // Display id for this output. |
| 63 int64_t display_id_; | 69 int64_t display_id_; |
| 64 | 70 |
| 65 // Display's origin on the framebuffer. | 71 // Display's origin on the framebuffer. |
| 66 gfx::Point origin_; | 72 gfx::Point origin_; |
| 67 | 73 |
| 68 gfx::Size physical_size_; | 74 gfx::Size physical_size_; |
| 69 | 75 |
| 70 DisplayConnectionType type_; | 76 DisplayConnectionType type_; |
| 71 | 77 |
| 72 bool is_aspect_preserving_scaling_; | 78 bool is_aspect_preserving_scaling_; |
| 73 | 79 |
| 74 bool has_overscan_; | 80 bool has_overscan_; |
| 75 | 81 |
| 82 bool has_color_correction_matrix_; |
| 83 |
| 76 std::string display_name_; | 84 std::string display_name_; |
| 77 | 85 |
| 78 std::vector<const DisplayMode*> modes_; // Not owned. | 86 std::vector<const DisplayMode*> modes_; // Not owned. |
| 79 | 87 |
| 80 // Mode currently being used by the output. | 88 // Mode currently being used by the output. |
| 81 const DisplayMode* current_mode_; | 89 const DisplayMode* current_mode_; |
| 82 | 90 |
| 83 // "Best" mode supported by the output. | 91 // "Best" mode supported by the output. |
| 84 const DisplayMode* native_mode_; | 92 const DisplayMode* native_mode_; |
| 85 | 93 |
| 86 // Combination of manufacturer and product code. | 94 // Combination of manufacturer and product code. |
| 87 int64_t product_id_; | 95 int64_t product_id_; |
| 88 | 96 |
| 89 DISALLOW_COPY_AND_ASSIGN(DisplaySnapshot); | 97 DISALLOW_COPY_AND_ASSIGN(DisplaySnapshot); |
| 90 }; | 98 }; |
| 91 | 99 |
| 92 } // namespace ui | 100 } // namespace ui |
| 93 | 101 |
| 94 #endif // UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ | 102 #endif // UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ |
| OLD | NEW |