| 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 UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ | 5 #ifndef UI_ACCELERATED_WIDGET_MAC_CA_RENDERER_LAYER_TREE_H_ |
| 6 #define UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ | 6 #define UI_ACCELERATED_WIDGET_MAC_CA_RENDERER_LAYER_TREE_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 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
| 16 #include "base/mac/scoped_nsobject.h" | 16 #include "base/mac/scoped_nsobject.h" |
| 17 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" | 17 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 19 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
| 20 #include "ui/gfx/mac/io_surface.h" | 20 #include "ui/gfx/mac/io_surface.h" |
| 21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
| 22 | 22 |
| 23 @class AVSampleBufferDisplayLayer; | 23 @class AVSampleBufferDisplayLayer; |
| 24 | 24 |
| 25 namespace ui { | 25 namespace ui { |
| 26 | 26 |
| 27 // The CALayerTree will construct a hierarchy of CALayers from a linear list, | 27 // The CARendererLayerTree will construct a hierarchy of CALayers from a linear |
| 28 // using the algorithm and structure referenced described in | 28 // list provided by the CoreAnimation renderer using the algorithm and structure |
| 29 // referenced described in |
| 29 // https://docs.google.com/document/d/1DtSN9zzvCF44_FQPM7ie01UxGHagQ66zfF5L9Hnig
QY/edit?usp=sharing | 30 // https://docs.google.com/document/d/1DtSN9zzvCF44_FQPM7ie01UxGHagQ66zfF5L9Hnig
QY/edit?usp=sharing |
| 30 class ACCELERATED_WIDGET_MAC_EXPORT CALayerTree { | 31 class ACCELERATED_WIDGET_MAC_EXPORT CARendererLayerTree { |
| 31 public: | 32 public: |
| 32 CALayerTree(); | 33 CARendererLayerTree(); |
| 33 | 34 |
| 34 // This will remove all CALayers from this tree from their superlayer. | 35 // This will remove all CALayers from this tree from their superlayer. |
| 35 ~CALayerTree(); | 36 ~CARendererLayerTree(); |
| 36 | 37 |
| 37 // Append the description of a new CALayer to the tree. This will not | 38 // Append the description of a new CALayer to the tree. This will not |
| 38 // create any new CALayers until CommitScheduledCALayers is called. This | 39 // create any new CALayers until CommitScheduledCALayers is called. This |
| 39 // cannot be called anymore after CommitScheduledCALayers has been called. | 40 // cannot be called anymore after CommitScheduledCALayers has been called. |
| 40 bool ScheduleCALayer(bool is_clipped, | 41 bool ScheduleCALayer(bool is_clipped, |
| 41 const gfx::Rect& clip_rect, | 42 const gfx::Rect& clip_rect, |
| 42 unsigned sorting_context_id, | 43 unsigned sorting_context_id, |
| 43 const gfx::Transform& transform, | 44 const gfx::Transform& transform, |
| 44 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 45 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 45 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, | 46 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, |
| 46 const gfx::RectF& contents_rect, | 47 const gfx::RectF& contents_rect, |
| 47 const gfx::Rect& rect, | 48 const gfx::Rect& rect, |
| 48 unsigned background_color, | 49 unsigned background_color, |
| 49 unsigned edge_aa_mask, | 50 unsigned edge_aa_mask, |
| 50 float opacity); | 51 float opacity); |
| 51 | 52 |
| 52 // Create a CALayer tree for the scheduled layers, and set |superlayer| to | 53 // Create a CALayer tree for the scheduled layers, and set |superlayer| to |
| 53 // have only this tree as its sublayers. If |old_tree| is non-null, then try | 54 // have only this tree as its sublayers. If |old_tree| is non-null, then try |
| 54 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will | 55 // to re-use the CALayers of |old_tree| as much as possible. |old_tree| will |
| 55 // be destroyed at the end of the function, and any CALayers in it which were | 56 // be destroyed at the end of the function, and any CALayers in it which were |
| 56 // not re-used by |this| will be removed from the CALayer hierarchy. | 57 // not re-used by |this| will be removed from the CALayer hierarchy. |
| 57 void CommitScheduledCALayers(CALayer* superlayer, | 58 void CommitScheduledCALayers(CALayer* superlayer, |
| 58 std::unique_ptr<CALayerTree> old_tree, | 59 std::unique_ptr<CARendererLayerTree> old_tree, |
| 59 float scale_factor); | 60 float scale_factor); |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 struct RootLayer; | 63 struct RootLayer; |
| 63 struct ClipAndSortingLayer; | 64 struct ClipAndSortingLayer; |
| 64 struct TransformLayer; | 65 struct TransformLayer; |
| 65 struct ContentLayer; | 66 struct ContentLayer; |
| 66 | 67 |
| 67 struct RootLayer { | 68 struct RootLayer { |
| 68 RootLayer(); | 69 RootLayer(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 198 |
| 198 private: | 199 private: |
| 199 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | 200 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
| 200 }; | 201 }; |
| 201 | 202 |
| 202 RootLayer root_layer_; | 203 RootLayer root_layer_; |
| 203 float scale_factor_ = 1; | 204 float scale_factor_ = 1; |
| 204 bool has_committed_ = false; | 205 bool has_committed_ = false; |
| 205 | 206 |
| 206 private: | 207 private: |
| 207 DISALLOW_COPY_AND_ASSIGN(CALayerTree); | 208 DISALLOW_COPY_AND_ASSIGN(CARendererLayerTree); |
| 208 }; | 209 }; |
| 209 | 210 |
| 210 } // namespace ui | 211 } // namespace ui |
| 211 | 212 |
| 212 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ | 213 #endif // UI_ACCELERATED_WIDGET_MAC_CA_LAYER_TREE_MAC_H_ |
| OLD | NEW |