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