OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CC_PICTURE_PILE_H_ | 5 #ifndef CC_PICTURE_PILE_H_ |
6 #define CC_PICTURE_PILE_H_ | 6 #define CC_PICTURE_PILE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
10 #include "cc/picture.h" | 10 #include "cc/picture.h" |
| 11 #include "cc/region.h" |
11 #include "cc/scoped_ptr_vector.h" | 12 #include "cc/scoped_ptr_vector.h" |
12 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
13 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
| 18 struct RenderingStats; |
| 19 |
17 class CC_EXPORT PicturePile { | 20 class CC_EXPORT PicturePile { |
18 public: | 21 public: |
19 PicturePile(); | 22 PicturePile(); |
20 ~PicturePile(); | 23 ~PicturePile(); |
21 | 24 |
22 // Mark a portion of the PicturePile as invalid and needing to be re-recorded | 25 // Mark a portion of the PicturePile as invalid and needing to be re-recorded |
23 // the next time update is called. | 26 // the next time update is called. |
24 void invalidate(gfx::Rect); | 27 void Invalidate(gfx::Rect); |
25 | 28 |
26 // Resize the PicturePile, invalidating / dropping recorded pictures as necess
ary. | 29 // Resize the PicturePile, invalidating / dropping recorded pictures as necess
ary. |
27 void resize(gfx::Size); | 30 void Resize(gfx::Size); |
28 | 31 |
29 // Rerecord parts of the picture that are invalid. | 32 // Re-record parts of the picture that are invalid. |
30 void update(ContentLayerClient* painter); | 33 void Update(ContentLayerClient* painter, RenderingStats&); |
31 | 34 |
32 // Update other with a shallow copy of this (main => compositor thread commit) | 35 // Update other with a shallow copy of this (main => compositor thread commit) |
33 void pushPropertiesTo(PicturePile& other); | 36 void PushPropertiesTo(PicturePile& other); |
34 | 37 |
35 // Clone a paint-safe version of this picture (with cloned PicturePileRecords) | 38 // Clone a paint-safe version of this picture (with cloned PicturePileRecords) |
36 scoped_ptr<PicturePile> cloneForDrawing(gfx::Rect rect); | 39 scoped_ptr<PicturePile> CloneForDrawing(); |
37 | 40 |
38 // Raster a subrect of this PicturePile into the given canvas. | 41 // Raster a subrect of this PicturePile into the given canvas. |
39 // It's only safe to call paint on a cloned version. | 42 // It's only safe to call paint on a cloned version. |
40 void paint(SkCanvas* canvas, gfx::Rect rect); | 43 // It is assumed that contentsScale has already been applied to this canvas. |
| 44 void Raster(SkCanvas* canvas, gfx::Rect rect); |
41 | 45 |
42 protected: | 46 private: |
| 47 void CopyAllButPile(PicturePile& from, PicturePile& to); |
| 48 |
43 std::vector<scoped_refptr<Picture> > pile_; | 49 std::vector<scoped_refptr<Picture> > pile_; |
44 gfx::Size size_; | 50 gfx::Size size_; |
| 51 Region invalidation_; |
| 52 Region prev_invalidation_; |
45 | 53 |
46 DISALLOW_COPY_AND_ASSIGN(PicturePile); | 54 DISALLOW_COPY_AND_ASSIGN(PicturePile); |
47 }; | 55 }; |
48 | 56 |
49 } // namespace cc | 57 } // namespace cc |
50 | 58 |
51 #endif // CC_PICTURE_PILE_H_ | 59 #endif // CC_PICTURE_PILE_H_ |
OLD | NEW |