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