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 UI_COMPOSITOR_PAINT_CONTEXT_H_ | 5 #ifndef UI_COMPOSITOR_PAINT_CONTEXT_H_ |
6 #define UI_COMPOSITOR_PAINT_CONTEXT_H_ | 6 #define UI_COMPOSITOR_PAINT_CONTEXT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "cc/paint/paint_recorder.h" |
12 #include "ui/compositor/compositor_export.h" | 13 #include "ui/compositor/compositor_export.h" |
13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 class DisplayItemList; | 17 class DisplayItemList; |
17 } | 18 } |
18 | 19 |
19 class SkPictureRecorder; | |
20 | |
21 namespace ui { | 20 namespace ui { |
22 class ClipRecorder; | 21 class ClipRecorder; |
23 class CompositingRecorder; | 22 class CompositingRecorder; |
24 class PaintRecorder; | 23 class PaintRecorder; |
25 class TransformRecorder; | 24 class TransformRecorder; |
26 | 25 |
27 class COMPOSITOR_EXPORT PaintContext { | 26 class COMPOSITOR_EXPORT PaintContext { |
28 public: | 27 public: |
29 // Construct a PaintContext that may only re-paint the area in the | 28 // Construct a PaintContext that may only re-paint the area in the |
30 // |invalidation|. | 29 // |invalidation|. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 friend class PaintCache; | 78 friend class PaintCache; |
80 | 79 |
81 // Returns a rect with the given size in the space of the context's | 80 // Returns a rect with the given size in the space of the context's |
82 // containing layer. | 81 // containing layer. |
83 gfx::Rect ToLayerSpaceBounds(const gfx::Size& size_in_context) const; | 82 gfx::Rect ToLayerSpaceBounds(const gfx::Size& size_in_context) const; |
84 | 83 |
85 // Returns the given rect translated by the layer space offset. | 84 // Returns the given rect translated by the layer space offset. |
86 gfx::Rect ToLayerSpaceRect(const gfx::Rect& rect) const; | 85 gfx::Rect ToLayerSpaceRect(const gfx::Rect& rect) const; |
87 | 86 |
88 cc::DisplayItemList* list_; | 87 cc::DisplayItemList* list_; |
89 std::unique_ptr<SkPictureRecorder> owned_recorder_; | 88 std::unique_ptr<cc::PaintRecorder> owned_recorder_; |
90 // A pointer to the |owned_recorder_| in this PaintContext, or in another one | 89 // A pointer to the |owned_recorder_| in this PaintContext, or in another one |
91 // which this was copied from. We expect a copied-from PaintContext to outlive | 90 // which this was copied from. We expect a copied-from PaintContext to outlive |
92 // copies made from it. | 91 // copies made from it. |
93 SkPictureRecorder* recorder_; | 92 cc::PaintRecorder* recorder_; |
94 // The device scale of the frame being painted. Used to determine which bitmap | 93 // The device scale of the frame being painted. Used to determine which bitmap |
95 // resources to use in the frame. | 94 // resources to use in the frame. |
96 float device_scale_factor_; | 95 float device_scale_factor_; |
97 // Invalidation in the space of the paint root (ie the space of the layer | 96 // Invalidation in the space of the paint root (ie the space of the layer |
98 // backing the paint taking place). | 97 // backing the paint taking place). |
99 gfx::Rect invalidation_; | 98 gfx::Rect invalidation_; |
100 // Offset from the PaintContext to the space of the paint root and the | 99 // Offset from the PaintContext to the space of the paint root and the |
101 // |invalidation_|. | 100 // |invalidation_|. |
102 gfx::Vector2d offset_; | 101 gfx::Vector2d offset_; |
103 | 102 |
104 #if DCHECK_IS_ON() | 103 #if DCHECK_IS_ON() |
105 // Used to verify that the |invalidation_| is only used to compare against | 104 // Used to verify that the |invalidation_| is only used to compare against |
106 // rects in the same space. | 105 // rects in the same space. |
107 mutable void* root_visited_; | 106 mutable void* root_visited_; |
108 // Used to verify that paint recorders are not nested. True while a paint | 107 // Used to verify that paint recorders are not nested. True while a paint |
109 // recorder is active. | 108 // recorder is active. |
110 mutable bool inside_paint_recorder_; | 109 mutable bool inside_paint_recorder_; |
111 #endif | 110 #endif |
112 | 111 |
113 DISALLOW_COPY_AND_ASSIGN(PaintContext); | 112 DISALLOW_COPY_AND_ASSIGN(PaintContext); |
114 }; | 113 }; |
115 | 114 |
116 } // namespace ui | 115 } // namespace ui |
117 | 116 |
118 #endif // UI_COMPOSITOR_PAINT_CONTEXT_H_ | 117 #endif // UI_COMPOSITOR_PAINT_CONTEXT_H_ |
OLD | NEW |