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
3 // found in the LICENSE file.
5 #ifndef UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_
6 #define UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_
10 #include "ui/display/types/display_constants.h"
11 #include "ui/display/types/display_mode.h"
12 #include "ui/gfx/geometry/point.h"
13 #include "ui/gfx/geometry/size.h"
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
19 // identifiers required to configure this display.
20 class DISPLAY_TYPES_EXPORT DisplaySnapshot
{
22 DisplaySnapshot(int64_t display_id
,
23 const gfx::Point
& origin
,
24 const gfx::Size
& physical_size
,
25 DisplayConnectionType type
,
26 bool is_aspect_preserving_scaling
,
28 std::string display_name
,
29 const std::vector
<const DisplayMode
*>& modes
,
30 const DisplayMode
* current_mode
,
31 const DisplayMode
* native_mode
);
32 virtual ~DisplaySnapshot();
34 const gfx::Point
& origin() const { return origin_
; }
35 const gfx::Size
& physical_size() const { return physical_size_
; }
36 ui::DisplayConnectionType
type() const { return type_
; }
37 bool is_aspect_preserving_scaling() const {
38 return is_aspect_preserving_scaling_
;
40 bool has_overscan() const { return has_overscan_
; }
41 std::string
display_name() const { return display_name_
; }
43 int64_t display_id() const { return display_id_
; }
45 const DisplayMode
* current_mode() const { return current_mode_
; }
46 const DisplayMode
* native_mode() const { return native_mode_
; }
48 const std::vector
<const DisplayMode
*>& modes() const { return modes_
; }
50 void set_current_mode(const DisplayMode
* mode
) { current_mode_
= mode
; }
51 void set_origin(const gfx::Point
& origin
) { origin_
= origin
; }
52 void add_mode(const DisplayMode
* mode
) { modes_
.push_back(mode
); }
54 // Returns a textual representation of this display state.
55 virtual std::string
ToString() const = 0;
58 // Display id for this output.
61 // Display's origin on the framebuffer.
64 gfx::Size physical_size_
;
66 DisplayConnectionType type_
;
68 bool is_aspect_preserving_scaling_
;
72 std::string display_name_
;
74 std::vector
<const DisplayMode
*> modes_
; // Not owned.
76 // Mode currently being used by the output.
77 const DisplayMode
* current_mode_
;
79 // "Best" mode supported by the output.
80 const DisplayMode
* native_mode_
;
82 DISALLOW_COPY_AND_ASSIGN(DisplaySnapshot
);
87 #endif // UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_