| 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 <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class Value; | 27 class Value; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace skia { | 30 namespace skia { |
| 31 class AnalysisCanvas; | 31 class AnalysisCanvas; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace cc { | 34 namespace cc { |
| 35 | 35 |
| 36 class ContentLayerClient; | 36 class ContentLayerClient; |
| 37 class RenderingStatsInstrumentation; | |
| 38 | 37 |
| 39 class CC_EXPORT Picture | 38 class CC_EXPORT Picture |
| 40 : public base::RefCountedThreadSafe<Picture> { | 39 : public base::RefCountedThreadSafe<Picture> { |
| 41 public: | 40 public: |
| 42 typedef std::pair<int, int> PixelRefMapKey; | 41 typedef std::pair<int, int> PixelRefMapKey; |
| 43 typedef std::vector<skia::LazyPixelRef*> PixelRefs; | 42 typedef std::vector<skia::LazyPixelRef*> PixelRefs; |
| 44 typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; | 43 typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; |
| 45 | 44 |
| 46 static scoped_refptr<Picture> Create(gfx::Rect layer_rect); | 45 static scoped_refptr<Picture> Create(gfx::Rect layer_rect); |
| 47 static scoped_refptr<Picture> CreateFromValue(const base::Value* value); | 46 static scoped_refptr<Picture> CreateFromValue(const base::Value* value); |
| 48 static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); | 47 static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); |
| 49 | 48 |
| 50 gfx::Rect LayerRect() const { return layer_rect_; } | 49 gfx::Rect LayerRect() const { return layer_rect_; } |
| 51 gfx::Rect OpaqueRect() const { return opaque_rect_; } | 50 gfx::Rect OpaqueRect() const { return opaque_rect_; } |
| 52 | 51 |
| 53 // Get thread-safe clone for rasterizing with on a specific thread. | 52 // Get thread-safe clone for rasterizing with on a specific thread. |
| 54 scoped_refptr<Picture> GetCloneForDrawingOnThread( | 53 scoped_refptr<Picture> GetCloneForDrawingOnThread( |
| 55 unsigned thread_index) const; | 54 unsigned thread_index) const; |
| 56 | 55 |
| 57 // Make thread-safe clones for rasterizing with. | 56 // Make thread-safe clones for rasterizing with. |
| 58 void CloneForDrawing(int num_threads); | 57 void CloneForDrawing(int num_threads); |
| 59 | 58 |
| 60 // Record a paint operation. To be able to safely use this SkPicture for | 59 // Record a paint operation. To be able to safely use this SkPicture for |
| 61 // playback on a different thread this can only be called once. | 60 // playback on a different thread this can only be called once. |
| 62 void Record(ContentLayerClient* client, | 61 void Record(ContentLayerClient* client, |
| 63 const SkTileGridPicture::TileGridInfo& tile_grid_info); | 62 const SkTileGridPicture::TileGridInfo& tile_grid_info); |
| 64 | 63 |
| 65 // Gather pixel refs from recording. | 64 // Gather pixel refs from recording. |
| 66 void GatherPixelRefs(const SkTileGridPicture::TileGridInfo& tile_grid_info, | 65 void GatherPixelRefs(const SkTileGridPicture::TileGridInfo& tile_grid_info); |
| 67 RenderingStatsInstrumentation* stats_instrumentation); | |
| 68 | 66 |
| 69 // Has Record() been called yet? | 67 // Has Record() been called yet? |
| 70 bool HasRecording() const { return picture_.get() != NULL; } | 68 bool HasRecording() const { return picture_.get() != NULL; } |
| 71 | 69 |
| 72 // Apply this contents scale and raster the content rect into the canvas. | 70 // Apply this contents scale and raster the content rect into the canvas. |
| 73 void Raster(SkCanvas* canvas, | 71 void Raster(SkCanvas* canvas, |
| 74 SkDrawPictureCallback* callback, | 72 SkDrawPictureCallback* callback, |
| 75 gfx::Rect content_rect, | 73 gfx::Rect content_rect, |
| 76 float contents_scale); | 74 float contents_scale); |
| 77 | 75 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 AsTraceableRecordData() const; | 147 AsTraceableRecordData() const; |
| 150 | 148 |
| 151 friend class base::RefCountedThreadSafe<Picture>; | 149 friend class base::RefCountedThreadSafe<Picture>; |
| 152 friend class PixelRefIterator; | 150 friend class PixelRefIterator; |
| 153 DISALLOW_COPY_AND_ASSIGN(Picture); | 151 DISALLOW_COPY_AND_ASSIGN(Picture); |
| 154 }; | 152 }; |
| 155 | 153 |
| 156 } // namespace cc | 154 } // namespace cc |
| 157 | 155 |
| 158 #endif // CC_RESOURCES_PICTURE_H_ | 156 #endif // CC_RESOURCES_PICTURE_H_ |
| OLD | NEW |