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_RECORDER_H_ | 5 #ifndef UI_COMPOSITOR_PAINT_RECORDER_H_ |
6 #define UI_COMPOSITOR_PAINT_RECORDER_H_ | 6 #define UI_COMPOSITOR_PAINT_RECORDER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "skia/ext/refptr.h" | 10 #include "skia/ext/refptr.h" |
11 #include "ui/compositor/compositor_export.h" | 11 #include "ui/compositor/compositor_export.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 class DisplayItemList; | 14 class DisplayItemList; |
15 } | 15 } |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class Canvas; | 18 class Canvas; |
19 } | 19 } |
20 | 20 |
21 class SkCanvas; | 21 class SkCanvas; |
22 class SkPictureRecorder; | 22 class SkPictureRecorder; |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 class PaintCache; | |
25 class PaintContext; | 26 class PaintContext; |
26 | 27 |
27 // A class to hide the complexity behind setting up a recording into a | 28 // A class to hide the complexity behind setting up a recording into a |
28 // DisplayItem. This is meant to be short-lived within the scope of recording | 29 // DisplayItem. This is meant to be short-lived within the scope of recording |
29 // taking place, the DisplayItem should be removed from the PaintRecorder once | 30 // taking place, the DisplayItem should be removed from the PaintRecorder once |
30 // recording is complete and can be cached. | 31 // recording is complete and can be cached. |
31 class COMPOSITOR_EXPORT PaintRecorder { | 32 class COMPOSITOR_EXPORT PaintRecorder { |
32 public: | 33 public: |
34 PaintRecorder(const PaintContext& context, PaintCache* cache); | |
sky
2015/04/23 16:29:00
Document ownership/lifetime of PaintCache.
danakj
2015/04/23 16:34:09
OK. To me raw pointer implies weak pointer that yo
| |
33 explicit PaintRecorder(const PaintContext& context); | 35 explicit PaintRecorder(const PaintContext& context); |
34 ~PaintRecorder(); | 36 ~PaintRecorder(); |
35 | 37 |
36 // Gets a gfx::Canvas for painting into. | 38 // Gets a gfx::Canvas for painting into. |
37 gfx::Canvas* canvas() { return canvas_; } | 39 gfx::Canvas* canvas() { return canvas_; } |
38 | 40 |
39 private: | 41 private: |
40 const PaintContext& context_; | 42 const PaintContext& context_; |
41 gfx::Canvas* canvas_; | 43 gfx::Canvas* canvas_; |
42 scoped_ptr<gfx::Canvas> owned_canvas_; | 44 scoped_ptr<gfx::Canvas> owned_canvas_; |
45 PaintCache* cache_; | |
43 | 46 |
44 DISALLOW_COPY_AND_ASSIGN(PaintRecorder); | 47 DISALLOW_COPY_AND_ASSIGN(PaintRecorder); |
45 }; | 48 }; |
46 | 49 |
47 } // namespace ui | 50 } // namespace ui |
48 | 51 |
49 #endif // UI_COMPOSITOR_PAINT_RECORDER_H_ | 52 #endif // UI_COMPOSITOR_PAINT_RECORDER_H_ |
OLD | NEW |