Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(686)

Side by Side Diff: ui/gfx/display_layout.h

Issue 1813493002: COMPLETED PREVIEW Migrate to Display Placement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gfxmove
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/display_layout.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_GFX_DISPLAY_LAYOUT_H_ 5 #ifndef UI_GFX_DISPLAY_LAYOUT_H_
6 #define UI_GFX_DISPLAY_LAYOUT_H_ 6 #define UI_GFX_DISPLAY_LAYOUT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // The id of the display this placement will be applied to. 48 // The id of the display this placement will be applied to.
49 int64_t display_id; 49 int64_t display_id;
50 50
51 // The parent display id to which the above display is placed. 51 // The parent display id to which the above display is placed.
52 int64_t parent_display_id; 52 int64_t parent_display_id;
53 53
54 // To which side the parent display the display is positioned. 54 // To which side the parent display the display is positioned.
55 enum Position { TOP, RIGHT, BOTTOM, LEFT }; 55 enum Position { TOP, RIGHT, BOTTOM, LEFT };
56 Position position; 56 Position position;
57 57
58 // The offset of the position of the secondary display. The offset is 58 // The offset of the position with respect to the parent.
59 // based on the top/left edge of the primary display.
60 int offset; 59 int offset;
61 60
62 explicit DisplayPlacement(const DisplayPlacement& placement); 61 // Determines if the offset is relative to the TOP_LEFT or the BOTTOM_RIGHT.
62 // Defaults to TOP_LEFT.
63 enum OffsetReference { TOP_LEFT, BOTTOM_RIGHT };
64 OffsetReference offset_reference;
65
63 DisplayPlacement(Position position, int offset); 66 DisplayPlacement(Position position, int offset);
67 DisplayPlacement(Position position,
68 int offset,
69 OffsetReference offset_reference);
70 DisplayPlacement(int64_t display_id,
71 int64_t parent_display_id,
72 Position position,
73 int offset,
74 OffsetReference offset_reference);
64 DisplayPlacement(); 75 DisplayPlacement();
65 76
77 DisplayPlacement(const DisplayPlacement& placement);
78
66 DisplayPlacement& Swap(); 79 DisplayPlacement& Swap();
67 80
68 std::string ToString() const; 81 std::string ToString() const;
69 82
70 static std::string PositionToString(Position position); 83 static std::string PositionToString(Position position);
71 static bool StringToPosition(const base::StringPiece& string, 84 static bool StringToPosition(const base::StringPiece& string,
72 Position* position); 85 Position* position);
73 }; 86 };
74 87
75 class GFX_EXPORT DisplayLayout final { 88 class GFX_EXPORT DisplayLayout final {
76 public: 89 public:
77 DisplayLayout(); 90 DisplayLayout();
78 ~DisplayLayout(); 91 ~DisplayLayout();
79 92
93 // Applies the layout and updates the bounds of displays in |display_list|.
94 // |updated_ids| contains the ids for displays whose bounds have changed.
95 void ApplyToDisplayList(DisplayList* display_list,
96 std::vector<int64_t>* updated_ids,
97 int minimum_offset_overlap) const;
98
99 // Apply the display placement to the display layout.
100 // Returns true if the display bounds has been updated.
101 bool ApplyDisplayPlacement(const gfx::DisplayPlacement& placement,
102 gfx::DisplayList* display_list,
103 int minimum_offset_overlap) const;
104
105
80 // Validates the layout object. 106 // Validates the layout object.
81 static bool Validate(const DisplayIdList& list, const DisplayLayout& layout); 107 static bool Validate(const DisplayIdList& list, const DisplayLayout& layout);
82 108
83 ScopedVector<DisplayPlacement> placement_list; 109 ScopedVector<DisplayPlacement> placement_list;
84 110
85 // True if displays are mirrored. 111 // True if displays are mirrored.
86 bool mirrored; 112 bool mirrored;
87 113
88 // True if multi displays should default to unified mode. 114 // True if multi displays should default to unified mode.
89 bool default_unified; 115 bool default_unified;
(...skipping 14 matching lines...) Expand all
104 // |display_id| if it exists, otherwise returns nullptr. 130 // |display_id| if it exists, otherwise returns nullptr.
105 const DisplayPlacement* FindPlacementById(int64_t display_id) const; 131 const DisplayPlacement* FindPlacementById(int64_t display_id) const;
106 132
107 private: 133 private:
108 DISALLOW_COPY_AND_ASSIGN(DisplayLayout); 134 DISALLOW_COPY_AND_ASSIGN(DisplayLayout);
109 }; 135 };
110 136
111 } // namespace gfx 137 } // namespace gfx
112 138
113 #endif 139 #endif
OLDNEW
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/display_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698