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_RESOURCES_PICTURE_H_ | 5 #ifndef CC_RESOURCES_PICTURE_H_ |
6 #define CC_RESOURCES_PICTURE_H_ | 6 #define CC_RESOURCES_PICTURE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
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 "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
14 #include "skia/ext/lazy_pixel_ref.h" | 14 #include "skia/ext/lazy_pixel_ref.h" |
15 #include "skia/ext/refptr.h" | 15 #include "skia/ext/refptr.h" |
16 #include "third_party/skia/include/core/SkPixelRef.h" | 16 #include "third_party/skia/include/core/SkPixelRef.h" |
17 #include "third_party/skia/include/core/SkTileGridPicture.h" | 17 #include "third_party/skia/include/core/SkTileGridPicture.h" |
18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
19 | 19 |
20 namespace skia { | 20 namespace skia { |
21 class AnalysisCanvas; | 21 class AnalysisCanvas; |
22 } | 22 } |
23 | 23 |
24 namespace cc { | 24 namespace cc { |
25 | 25 |
26 class ContentLayerClient; | 26 class ContentLayerClient; |
27 struct RenderingStats; | 27 struct RenderingStatsInstrumentation; |
28 | 28 |
29 class CC_EXPORT Picture | 29 class CC_EXPORT Picture |
30 : public base::RefCountedThreadSafe<Picture> { | 30 : public base::RefCountedThreadSafe<Picture> { |
31 public: | 31 public: |
32 static scoped_refptr<Picture> Create(gfx::Rect layer_rect); | 32 static scoped_refptr<Picture> Create(gfx::Rect layer_rect); |
33 | 33 |
34 const gfx::Rect& LayerRect() const { return layer_rect_; } | 34 const gfx::Rect& LayerRect() const { return layer_rect_; } |
35 const gfx::Rect& OpaqueRect() const { return opaque_rect_; } | 35 const gfx::Rect& OpaqueRect() const { return opaque_rect_; } |
36 | 36 |
37 // Get thread-safe clone for rasterizing with on a specific thread. | 37 // Get thread-safe clone for rasterizing with on a specific thread. |
38 scoped_refptr<Picture> GetCloneForDrawingOnThread( | 38 scoped_refptr<Picture> GetCloneForDrawingOnThread( |
39 unsigned thread_index) const; | 39 unsigned thread_index) const; |
40 | 40 |
41 // Make thread-safe clones for rasterizing with. | 41 // Make thread-safe clones for rasterizing with. |
42 void CloneForDrawing(int num_threads); | 42 void CloneForDrawing(int num_threads); |
43 | 43 |
44 // Record a paint operation. To be able to safely use this SkPicture for | 44 // Record a paint operation. To be able to safely use this SkPicture for |
45 // playback on a different thread this can only be called once. | 45 // playback on a different thread this can only be called once. |
46 void Record(ContentLayerClient*, RenderingStats*, | 46 void Record(ContentLayerClient*, RenderingStatsInstrumentation*, |
danakj
2013/03/23 01:56:32
variables need names
egraether
2013/03/25 21:07:44
Done.
| |
47 const SkTileGridPicture::TileGridInfo& tileGridInfo); | 47 const SkTileGridPicture::TileGridInfo& tileGridInfo); |
48 | 48 |
49 // Has Record() been called yet? | 49 // Has Record() been called yet? |
50 bool HasRecording() const { return picture_.get() != NULL; } | 50 bool HasRecording() const { return picture_.get() != NULL; } |
51 | 51 |
52 // Apply this contents scale and raster the content rect into the canvas. | 52 // Apply this contents scale and raster the content rect into the canvas. |
53 void Raster(SkCanvas* canvas, gfx::Rect content_rect, float contents_scale); | 53 void Raster(SkCanvas* canvas, gfx::Rect content_rect, float contents_scale); |
54 | 54 |
55 void GatherPixelRefs( | 55 void GatherPixelRefs( |
56 const gfx::Rect& layer_rect, | 56 const gfx::Rect& layer_rect, |
(...skipping 15 matching lines...) Expand all Loading... | |
72 typedef std::vector<scoped_refptr<Picture> > PictureVector; | 72 typedef std::vector<scoped_refptr<Picture> > PictureVector; |
73 PictureVector clones_; | 73 PictureVector clones_; |
74 | 74 |
75 friend class base::RefCountedThreadSafe<Picture>; | 75 friend class base::RefCountedThreadSafe<Picture>; |
76 DISALLOW_COPY_AND_ASSIGN(Picture); | 76 DISALLOW_COPY_AND_ASSIGN(Picture); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace cc | 79 } // namespace cc |
80 | 80 |
81 #endif // CC_RESOURCES_PICTURE_H_ | 81 #endif // CC_RESOURCES_PICTURE_H_ |
OLD | NEW |