OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ | |
6 #define CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ | |
7 | |
8 #include <IOSurface/IOSurface.h> | |
9 #include <QuartzCore/QuartzCore.h> | |
10 #include <deque> | |
11 | |
12 #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_f.h" | |
16 | |
17 namespace content { | |
18 | |
19 class CALayerPartialDamageTree { | |
20 public: | |
21 CALayerPartialDamageTree(bool allow_partial_swap, | |
22 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | |
23 const gfx::Rect& pixel_frame_rect); | |
24 ~CALayerPartialDamageTree(); | |
25 | |
26 base::ScopedCFTypeRef<IOSurfaceRef> RootLayerIOSurface(); | |
27 void CommitCALayers(CALayer* superlayer, | |
28 scoped_ptr<CALayerPartialDamageTree> old_tree, | |
29 float scale_factor, | |
30 const gfx::Rect& pixel_damage_rect); | |
31 | |
32 private: | |
33 class OverlayPlane; | |
34 | |
35 // This will populate |partial_damage_planes_|, potentially re-using the | |
36 // 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 // 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); | |
48 | |
49 const bool allow_partial_swap_; | |
50 scoped_ptr<OverlayPlane> root_plane_; | |
51 std::deque<scoped_ptr<OverlayPlane>> partial_damage_planes_; | |
52 }; | |
53 | |
54 } // content | |
55 | |
56 #endif // CONTENT_COMMON_GPU_CA_LAYER_PARTIAL_DAMAGE_TREE_MAC_H_ | |
OLD | NEW |