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 <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 using PropertyDeallocator = void (*)(int64_t value); | 95 using PropertyDeallocator = void (*)(int64_t value); |
96 | 96 |
97 Surface(); | 97 Surface(); |
98 ~Surface() override; | 98 ~Surface() override; |
99 | 99 |
100 // Type-checking downcast routine. | 100 // Type-checking downcast routine. |
101 static Surface* AsSurface(const aura::Window* window); | 101 static Surface* AsSurface(const aura::Window* window); |
102 | 102 |
103 aura::Window* window() { return window_.get(); } | 103 aura::Window* window() { return window_.get(); } |
104 | 104 |
105 cc::SurfaceId surface_id() const { return surface_id_; } | 105 const cc::SurfaceId& surface_id() const { return surface_id_; } |
106 | 106 |
107 // Set a buffer as the content of this surface. A buffer can only be attached | 107 // Set a buffer as the content of this surface. A buffer can only be attached |
108 // to one surface at a time. | 108 // to one surface at a time. |
109 void Attach(Buffer* buffer); | 109 void Attach(Buffer* buffer); |
110 | 110 |
111 // Describe the regions where the pending buffer is different from the | 111 // Describe the regions where the pending buffer is different from the |
112 // current surface contents, and where the surface therefore needs to be | 112 // current surface contents, and where the surface therefore needs to be |
113 // repainted. | 113 // repainted. |
114 void Damage(const gfx::Rect& rect); | 114 void Damage(const gfx::Rect& rect); |
115 | 115 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 bool HasPendingDamageForTesting(const gfx::Rect& damage) const { | 208 bool HasPendingDamageForTesting(const gfx::Rect& damage) const { |
209 return pending_damage_.contains(gfx::RectToSkIRect(damage)); | 209 return pending_damage_.contains(gfx::RectToSkIRect(damage)); |
210 } | 210 } |
211 | 211 |
212 // Overridden from ui::LayerOwnerDelegate: | 212 // Overridden from ui::LayerOwnerDelegate: |
213 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; | 213 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; |
214 | 214 |
215 // Overridden from ui::ContextFactoryObserver. | 215 // Overridden from ui::ContextFactoryObserver. |
216 void OnLostResources() override; | 216 void OnLostResources() override; |
217 | 217 |
218 void WillDraw(cc::SurfaceId surface_id); | 218 void WillDraw(const cc::SurfaceId& surface_id); |
219 | 219 |
220 // Check whether this Surface and its children need to create new cc::Surface | 220 // Check whether this Surface and its children need to create new cc::Surface |
221 // IDs for their contents next time they get new buffer contents. | 221 // IDs for their contents next time they get new buffer contents. |
222 void CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); | 222 void CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); |
223 | 223 |
224 gfx::Size content_size() const { return content_size_; } | 224 gfx::Size content_size() const { return content_size_; } |
225 | 225 |
226 // Sets the |value| of the given surface |property|. Setting to the default | 226 // Sets the |value| of the given surface |property|. Setting to the default |
227 // value (e.g., NULL) removes the property. The caller is responsible for the | 227 // value (e.g., NULL) removes the property. The caller is responsible for the |
228 // lifetime of any object set as a property on the Surface. | 228 // lifetime of any object set as a property on the Surface. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 // Surface observer list. Surface does not own the observers. | 401 // Surface observer list. Surface does not own the observers. |
402 base::ObserverList<SurfaceObserver, true> observers_; | 402 base::ObserverList<SurfaceObserver, true> observers_; |
403 | 403 |
404 DISALLOW_COPY_AND_ASSIGN(Surface); | 404 DISALLOW_COPY_AND_ASSIGN(Surface); |
405 }; | 405 }; |
406 | 406 |
407 } // namespace exo | 407 } // namespace exo |
408 | 408 |
409 #endif // COMPONENTS_EXO_SURFACE_H_ | 409 #endif // COMPONENTS_EXO_SURFACE_H_ |
OLD | NEW |