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 <list> | 8 #include <list> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Make a thread-safe clone for rasterizing with. | 32 // Make a thread-safe clone for rasterizing with. |
33 scoped_refptr<Picture> Clone() const; | 33 scoped_refptr<Picture> Clone() const; |
34 | 34 |
35 // Record a paint operation. To be able to safely use this SkPicture for | 35 // Record a paint operation. To be able to safely use this SkPicture for |
36 // playback on a different thread this can only be called once. | 36 // playback on a different thread this can only be called once. |
37 void Record(ContentLayerClient*, RenderingStats&); | 37 void Record(ContentLayerClient*, RenderingStats&); |
38 | 38 |
39 // Has Record() been called yet? | 39 // Has Record() been called yet? |
40 bool HasRecording() const { return picture_.get(); } | 40 bool HasRecording() const { return picture_.get(); } |
41 | 41 |
42 // Raster this Picture's layer_rect into the given canvas. | 42 // Apply this contents scale and raster the content rect into the canvas. |
43 // Assumes contentsScale have already been applied. | 43 void Raster(SkCanvas* canvas, gfx::Rect content_rect, float contents_scale); |
44 void Raster(SkCanvas* canvas); | |
45 | 44 |
46 void GatherPixelRefs(const gfx::Rect& rect, | 45 void GatherPixelRefs(const gfx::Rect& rect, |
47 std::list<skia::LazyPixelRef*>&); | 46 std::list<skia::LazyPixelRef*>&); |
48 | 47 |
49 private: | 48 private: |
50 Picture(gfx::Rect layer_rect); | 49 Picture(gfx::Rect layer_rect); |
51 // This constructor assumes SkPicture is already ref'd and transfers | 50 // This constructor assumes SkPicture is already ref'd and transfers |
52 // ownership to this picture. | 51 // ownership to this picture. |
53 Picture(const skia::RefPtr<SkPicture>&, | 52 Picture(const skia::RefPtr<SkPicture>&, |
54 gfx::Rect layer_rect, | 53 gfx::Rect layer_rect, |
55 gfx::Rect opaque_rect); | 54 gfx::Rect opaque_rect); |
56 ~Picture(); | 55 ~Picture(); |
57 | 56 |
58 gfx::Rect layer_rect_; | 57 gfx::Rect layer_rect_; |
59 gfx::Rect opaque_rect_; | 58 gfx::Rect opaque_rect_; |
60 skia::RefPtr<SkPicture> picture_; | 59 skia::RefPtr<SkPicture> picture_; |
61 | 60 |
62 friend class base::RefCountedThreadSafe<Picture>; | 61 friend class base::RefCountedThreadSafe<Picture>; |
63 DISALLOW_COPY_AND_ASSIGN(Picture); | 62 DISALLOW_COPY_AND_ASSIGN(Picture); |
64 }; | 63 }; |
65 | 64 |
66 } // namespace cc | 65 } // namespace cc |
67 | 66 |
68 #endif // CC_PICTURE_H_ | 67 #endif // CC_PICTURE_H_ |
OLD | NEW |