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_H_ | 5 #ifndef CC_PICTURE_H_ |
6 #define CC_PICTURE_H_ | 6 #define CC_PICTURE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
11 #include "third_party/skia/include/core/SkPicture.h" | 11 #include "third_party/skia/include/core/SkPicture.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 class ContentLayerClient; | 16 class ContentLayerClient; |
| 17 struct RenderingStats; |
17 | 18 |
18 class CC_EXPORT Picture | 19 class CC_EXPORT Picture |
19 : public base::RefCountedThreadSafe<Picture> { | 20 : public base::RefCountedThreadSafe<Picture> { |
20 public: | 21 public: |
21 scoped_refptr<Picture> create(ContentLayerClient*, gfx::Rect); | 22 static scoped_refptr<Picture> Create(); |
22 | 23 |
23 const gfx::Rect& rect(); | 24 const gfx::Rect& LayerRect() const { return layer_rect_; } |
24 scoped_refptr<Picture> clone(); | 25 const gfx::Rect& OpaqueRect() const { return opaque_rect_; } |
25 | 26 |
26 protected: | 27 // Make a thread-safe clone for rasterizing with. |
| 28 scoped_refptr<Picture> Clone(); |
| 29 |
| 30 // Record a paint operation (clobbering any previous recording). |
| 31 void Record(ContentLayerClient*, gfx::Rect layer_rect, RenderingStats&); |
| 32 |
| 33 // Raster this Picture's layer_rect into the given canvas. |
| 34 // Assumes contentsScale have already been applied. |
| 35 void Raster(SkCanvas* canvas); |
| 36 |
| 37 private: |
27 Picture(); | 38 Picture(); |
| 39 // This constructor assumes SkPicture is already ref'd and transfers |
| 40 // ownership to this picture. |
| 41 Picture(SkPicture*, gfx::Rect layer_rect, gfx::Rect opaque_rect); |
28 ~Picture(); | 42 ~Picture(); |
29 | 43 |
30 gfx::Rect m_rect; | 44 gfx::Rect layer_rect_; |
31 SkPicture m_picture; | 45 gfx::Rect opaque_rect_; |
| 46 SkAutoTUnref<SkPicture> picture_; |
32 | 47 |
33 private: | |
34 friend class base::RefCountedThreadSafe<Picture>; | 48 friend class base::RefCountedThreadSafe<Picture>; |
35 | |
36 DISALLOW_COPY_AND_ASSIGN(Picture); | 49 DISALLOW_COPY_AND_ASSIGN(Picture); |
37 }; | 50 }; |
38 | 51 |
39 } // namespace cc | 52 } // namespace cc |
40 | 53 |
41 #endif // CC_PICTURE_H_ | 54 #endif // CC_PICTURE_H_ |
OLD | NEW |