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_IMPL_H_ | 5 #ifndef CC_PICTURE_PILE_IMPL_H_ |
6 #define CC_PICTURE_PILE_IMPL_H_ | 6 #define CC_PICTURE_PILE_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "cc/cc_export.h" | 14 #include "cc/cc_export.h" |
15 #include "cc/picture.h" | 15 #include "cc/picture.h" |
16 #include "cc/picture_pile.h" | 16 #include "cc/picture_pile.h" |
17 #include "cc/scoped_ptr_vector.h" | 17 #include "cc/scoped_ptr_vector.h" |
| 18 #include "skia/ext/refptr.h" |
| 19 #include "third_party/skia/include/core/SkPicture.h" |
18 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
19 | 21 |
20 namespace cc { | 22 namespace cc { |
21 struct RenderingStats; | 23 struct RenderingStats; |
22 | 24 |
23 class CC_EXPORT PicturePileImpl : public base::RefCounted<PicturePileImpl> { | 25 class CC_EXPORT PicturePileImpl : public base::RefCounted<PicturePileImpl> { |
24 public: | 26 public: |
25 static scoped_refptr<PicturePileImpl> Create(); | 27 static scoped_refptr<PicturePileImpl> Create(); |
26 | 28 |
27 // Get paint-safe version of this picture for a specific thread. | 29 // Get paint-safe version of this picture for a specific thread. |
28 PicturePileImpl* GetCloneForDrawingOnThread(base::Thread*); | 30 PicturePileImpl* GetCloneForDrawingOnThread(base::Thread*); |
29 | 31 |
30 // Clone a paint-safe version of this picture. | 32 // Clone a paint-safe version of this picture. |
31 scoped_refptr<PicturePileImpl> CloneForDrawing() const; | 33 scoped_refptr<PicturePileImpl> CloneForDrawing() const; |
32 | 34 |
33 // Raster a subrect of this PicturePileImpl into the given canvas. | 35 // Raster a subrect of this PicturePileImpl into the given canvas. |
34 // It's only safe to call paint on a cloned version. | 36 // It's only safe to call paint on a cloned version. |
35 // It is assumed that contentsScale has already been applied to this canvas. | 37 // It is assumed that contentsScale has already been applied to this canvas. |
36 void Raster( | 38 void Raster( |
37 SkCanvas* canvas, | 39 SkCanvas* canvas, |
38 gfx::Rect content_rect, | 40 gfx::Rect content_rect, |
39 float contents_scale, | 41 float contents_scale, |
40 RenderingStats* stats); | 42 RenderingStats* stats); |
41 | 43 |
42 void GatherPixelRefs(const gfx::Rect&, std::list<skia::LazyPixelRef*>&); | 44 void GatherPixelRefs(const gfx::Rect&, std::list<skia::LazyPixelRef*>&); |
43 | 45 |
| 46 skia::RefPtr<SkPicture> GetFlattenedPicture(); |
| 47 |
44 private: | 48 private: |
45 friend class PicturePile; | 49 friend class PicturePile; |
46 | 50 |
47 PicturePileImpl(); | 51 PicturePileImpl(); |
48 ~PicturePileImpl(); | 52 ~PicturePileImpl(); |
49 | 53 |
50 PicturePile::Pile pile_; | 54 PicturePile::Pile pile_; |
51 float min_contents_scale_; | 55 float min_contents_scale_; |
52 | 56 |
53 typedef std::map<base::PlatformThreadId, scoped_refptr<PicturePileImpl> > | 57 typedef std::map<base::PlatformThreadId, scoped_refptr<PicturePileImpl> > |
54 CloneMap; | 58 CloneMap; |
55 CloneMap clones_; | 59 CloneMap clones_; |
56 | 60 |
57 friend class base::RefCounted<PicturePileImpl>; | 61 friend class base::RefCounted<PicturePileImpl>; |
58 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); | 62 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); |
59 }; | 63 }; |
60 | 64 |
61 } // namespace cc | 65 } // namespace cc |
62 | 66 |
63 #endif // CC_PICTURE_PILE_IMPL_H_ | 67 #endif // CC_PICTURE_PILE_IMPL_H_ |
OLD | NEW |