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 "skia/ext/refptr.h" |
11 #include "third_party/skia/include/core/SkPicture.h" | 12 #include "third_party/skia/include/core/SkPicture.h" |
12 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 class ContentLayerClient; | 17 class ContentLayerClient; |
17 struct RenderingStats; | 18 struct RenderingStats; |
18 | 19 |
19 class CC_EXPORT Picture | 20 class CC_EXPORT Picture |
20 : public base::RefCountedThreadSafe<Picture> { | 21 : public base::RefCountedThreadSafe<Picture> { |
(...skipping 11 matching lines...) Expand all Loading... |
32 void Record(ContentLayerClient*, gfx::Rect layer_rect, RenderingStats&); | 33 void Record(ContentLayerClient*, gfx::Rect layer_rect, RenderingStats&); |
33 | 34 |
34 // Raster this Picture's layer_rect into the given canvas. | 35 // Raster this Picture's layer_rect into the given canvas. |
35 // Assumes contentsScale have already been applied. | 36 // Assumes contentsScale have already been applied. |
36 void Raster(SkCanvas* canvas); | 37 void Raster(SkCanvas* canvas); |
37 | 38 |
38 private: | 39 private: |
39 Picture(); | 40 Picture(); |
40 // This constructor assumes SkPicture is already ref'd and transfers | 41 // This constructor assumes SkPicture is already ref'd and transfers |
41 // ownership to this picture. | 42 // ownership to this picture. |
42 Picture(SkPicture*, gfx::Rect layer_rect, gfx::Rect opaque_rect); | 43 Picture(const skia::RefPtr<SkPicture>&, |
| 44 gfx::Rect layer_rect, |
| 45 gfx::Rect opaque_rect); |
43 ~Picture(); | 46 ~Picture(); |
44 | 47 |
45 gfx::Rect layer_rect_; | 48 gfx::Rect layer_rect_; |
46 gfx::Rect opaque_rect_; | 49 gfx::Rect opaque_rect_; |
47 SkAutoTUnref<SkPicture> picture_; | 50 skia::RefPtr<SkPicture> picture_; |
48 | 51 |
49 friend class base::RefCountedThreadSafe<Picture>; | 52 friend class base::RefCountedThreadSafe<Picture>; |
50 DISALLOW_COPY_AND_ASSIGN(Picture); | 53 DISALLOW_COPY_AND_ASSIGN(Picture); |
51 }; | 54 }; |
52 | 55 |
53 } // namespace cc | 56 } // namespace cc |
54 | 57 |
55 #endif // CC_PICTURE_H_ | 58 #endif // CC_PICTURE_H_ |
OLD | NEW |