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 class 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* painter, |
47 const SkTileGridPicture::TileGridInfo& tile_grid_info); | 47 RenderingStatsInstrumentation* stats_instrumentation, |
| 48 const SkTileGridPicture::TileGridInfo& tile_grid_info); |
48 | 49 |
49 // Has Record() been called yet? | 50 // Has Record() been called yet? |
50 bool HasRecording() const { return picture_.get() != NULL; } | 51 bool HasRecording() const { return picture_.get() != NULL; } |
51 | 52 |
52 // Apply this contents scale and raster the content rect into the canvas. | 53 // Apply this contents scale and raster the content rect into the canvas. |
53 void Raster(SkCanvas* canvas, | 54 void Raster(SkCanvas* canvas, |
54 gfx::Rect content_rect, | 55 gfx::Rect content_rect, |
55 float contents_scale, | 56 float contents_scale, |
56 bool enable_lcd_text); | 57 bool enable_lcd_text); |
57 | 58 |
(...skipping 17 matching lines...) Expand all Loading... |
75 typedef std::vector<scoped_refptr<Picture> > PictureVector; | 76 typedef std::vector<scoped_refptr<Picture> > PictureVector; |
76 PictureVector clones_; | 77 PictureVector clones_; |
77 | 78 |
78 friend class base::RefCountedThreadSafe<Picture>; | 79 friend class base::RefCountedThreadSafe<Picture>; |
79 DISALLOW_COPY_AND_ASSIGN(Picture); | 80 DISALLOW_COPY_AND_ASSIGN(Picture); |
80 }; | 81 }; |
81 | 82 |
82 } // namespace cc | 83 } // namespace cc |
83 | 84 |
84 #endif // CC_RESOURCES_PICTURE_H_ | 85 #endif // CC_RESOURCES_PICTURE_H_ |
OLD | NEW |