OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_EXO_SURFACE_H_ | 5 #ifndef COMPONENTS_EXO_SURFACE_H_ |
6 #define COMPONENTS_EXO_SURFACE_H_ | 6 #define COMPONENTS_EXO_SURFACE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 void Damage(const gfx::Rect& rect); | 48 void Damage(const gfx::Rect& rect); |
49 | 49 |
50 // Request notification when the next frame is displayed. Useful for | 50 // Request notification when the next frame is displayed. Useful for |
51 // throttling redrawing operations, and driving animations. | 51 // throttling redrawing operations, and driving animations. |
52 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; | 52 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; |
53 void RequestFrameCallback(const FrameCallback& callback); | 53 void RequestFrameCallback(const FrameCallback& callback); |
54 | 54 |
55 // This sets the region of the surface that contains opaque content. | 55 // This sets the region of the surface that contains opaque content. |
56 void SetOpaqueRegion(const SkRegion& region); | 56 void SetOpaqueRegion(const SkRegion& region); |
57 | 57 |
| 58 // This sets the scaling factor used to interpret the contents of the buffer |
| 59 // attached to the surface. Note that if the scale is larger than 1, then you |
| 60 // have to attach a buffer that is larger (by a factor of scale in each |
| 61 // dimension) than the desired surface size. |
| 62 void SetBufferScale(float scale); |
| 63 |
58 // Functions that control sub-surface state. All sub-surface state is | 64 // Functions that control sub-surface state. All sub-surface state is |
59 // double-buffered and will be applied when Commit() is called. | 65 // double-buffered and will be applied when Commit() is called. |
60 void AddSubSurface(Surface* sub_surface); | 66 void AddSubSurface(Surface* sub_surface); |
61 void RemoveSubSurface(Surface* sub_surface); | 67 void RemoveSubSurface(Surface* sub_surface); |
62 void SetSubSurfacePosition(Surface* sub_surface, const gfx::Point& position); | 68 void SetSubSurfacePosition(Surface* sub_surface, const gfx::Point& position); |
63 void PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference); | 69 void PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference); |
64 void PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling); | 70 void PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling); |
65 | 71 |
66 // Surface state (damage regions, attached buffers, etc.) is double-buffered. | 72 // Surface state (damage regions, attached buffers, etc.) is double-buffered. |
67 // A Commit() call atomically applies all pending state, replacing the | 73 // A Commit() call atomically applies all pending state, replacing the |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // |active_frame_callbacks_| when the effect of the Commit() is reflected in | 138 // |active_frame_callbacks_| when the effect of the Commit() is reflected in |
133 // the compositor's active layer tree. The callbacks fire once we're notified | 139 // the compositor's active layer tree. The callbacks fire once we're notified |
134 // that the compositor started drawing that active layer tree. | 140 // that the compositor started drawing that active layer tree. |
135 std::list<FrameCallback> pending_frame_callbacks_; | 141 std::list<FrameCallback> pending_frame_callbacks_; |
136 std::list<FrameCallback> frame_callbacks_; | 142 std::list<FrameCallback> frame_callbacks_; |
137 std::list<FrameCallback> active_frame_callbacks_; | 143 std::list<FrameCallback> active_frame_callbacks_; |
138 | 144 |
139 // The opaque region to take effect when Commit() is called. | 145 // The opaque region to take effect when Commit() is called. |
140 SkRegion pending_opaque_region_; | 146 SkRegion pending_opaque_region_; |
141 | 147 |
| 148 // The buffer scaling factor to take effect when Commit() is called. |
| 149 float pending_buffer_scale_; |
| 150 |
142 // The stack of sub-surfaces to take effect when Commit() is called. | 151 // The stack of sub-surfaces to take effect when Commit() is called. |
143 // Bottom-most sub-surface at the front of the list and top-most sub-surface | 152 // Bottom-most sub-surface at the front of the list and top-most sub-surface |
144 // at the back. | 153 // at the back. |
145 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; | 154 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; |
146 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; | 155 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; |
147 SubSurfaceEntryList pending_sub_surfaces_; | 156 SubSurfaceEntryList pending_sub_surfaces_; |
148 | 157 |
149 // The buffer that is currently set as content of surface. | 158 // The buffer that is currently set as content of surface. |
150 base::WeakPtr<Buffer> current_buffer_; | 159 base::WeakPtr<Buffer> current_buffer_; |
151 | 160 |
(...skipping 15 matching lines...) Expand all Loading... |
167 | 176 |
168 // Surface observer list. Surface does not own the observers. | 177 // Surface observer list. Surface does not own the observers. |
169 base::ObserverList<SurfaceObserver, true> observers_; | 178 base::ObserverList<SurfaceObserver, true> observers_; |
170 | 179 |
171 DISALLOW_COPY_AND_ASSIGN(Surface); | 180 DISALLOW_COPY_AND_ASSIGN(Surface); |
172 }; | 181 }; |
173 | 182 |
174 } // namespace exo | 183 } // namespace exo |
175 | 184 |
176 #endif // COMPONENTS_EXO_SURFACE_H_ | 185 #endif // COMPONENTS_EXO_SURFACE_H_ |
OLD | NEW |