OLD | NEW |
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 CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ | 5 #ifndef CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ |
6 #define CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ | 6 #define CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ |
7 | 7 |
8 #include <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 #include <deque> | 10 #include <deque> |
11 | 11 |
12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
13 #include "base/memory/linked_ptr.h" | |
14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
15 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/gfx/geometry/rect_f.h" | 15 #include "ui/gfx/geometry/rect_f.h" |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 | 18 |
20 class CALayerPartialDamageTree { | 19 class CALayerPartialDamageTree { |
21 public: | 20 public: |
22 CALayerPartialDamageTree(bool allow_partial_swap, | 21 CALayerPartialDamageTree(bool allow_partial_swap, |
23 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 22 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
24 const gfx::Rect& pixel_frame_rect); | 23 const gfx::Rect& pixel_frame_rect); |
25 ~CALayerPartialDamageTree(); | 24 ~CALayerPartialDamageTree(); |
26 | 25 |
27 base::ScopedCFTypeRef<IOSurfaceRef> RootLayerIOSurface(); | 26 base::ScopedCFTypeRef<IOSurfaceRef> RootLayerIOSurface(); |
28 void CommitCALayers(CALayer* superlayer, | 27 void CommitCALayers(CALayer* superlayer, |
29 scoped_ptr<CALayerPartialDamageTree> old_tree, | 28 scoped_ptr<CALayerPartialDamageTree> old_tree, |
30 float scale_factor, | 29 float scale_factor, |
31 const gfx::Rect& pixel_damage_rect); | 30 const gfx::Rect& pixel_damage_rect); |
32 | 31 |
33 private: | 32 private: |
34 class OverlayPlane; | 33 class OverlayPlane; |
35 | 34 |
36 void UpdateRootAndPartialDamagePlanes(CALayerPartialDamageTree* old_tree, | 35 // This will populate |partial_damage_planes_|, potentially re-using the |
37 const gfx::RectF& pixel_damage_rect); | 36 // CALayers and |partial_damage_planes_| from |old_tree|. After this function |
38 void UpdateRootAndPartialDamageCALayers(CALayer* superlayer, | 37 // completes, the back() of |partial_damage_planes_| is the plane that will |
39 float scale_factor); | 38 // be updated this frame (and if it is empty, then the root plane will be |
| 39 // updated). |
| 40 void UpdatePartialDamagePlanes(CALayerPartialDamageTree* old_tree, |
| 41 const gfx::Rect& pixel_damage_rect); |
| 42 |
| 43 void UpdateRootAndPartialDamagePlanes( |
| 44 scoped_ptr<CALayerPartialDamageTree> old_tree, |
| 45 const gfx::Rect& pixel_damage_rect); |
| 46 |
| 47 void UpdateCALayers(CALayer* superlayer, float scale_factor); |
40 | 48 |
41 const bool allow_partial_swap_; | 49 const bool allow_partial_swap_; |
42 linked_ptr<OverlayPlane> root_plane_; | 50 scoped_ptr<OverlayPlane> root_plane_; |
43 std::deque<linked_ptr<OverlayPlane>> partial_damage_planes_; | 51 std::deque<scoped_ptr<OverlayPlane>> partial_damage_planes_; |
44 }; | 52 }; |
45 | 53 |
46 } // content | 54 } // content |
47 | 55 |
48 #endif // CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ | 56 #endif // CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ |
OLD | NEW |