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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
20 #include "cc/base/cc_export.h" | 20 #include "cc/base/cc_export.h" |
21 #include "cc/base/region.h" | 21 #include "cc/base/region.h" |
22 #include "skia/ext/refptr.h" | 22 #include "skia/ext/refptr.h" |
23 #include "third_party/skia/include/core/SkTileGridPicture.h" | 23 #include "third_party/skia/include/core/SkTileGridPicture.h" |
| 24 #include "third_party/skia/include/record/SkRecording.h" |
24 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
25 | 26 |
26 class SkPixelRef; | 27 class SkPixelRef; |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 class Value; | 30 class Value; |
30 } | 31 } |
31 | 32 |
32 namespace skia { | 33 namespace skia { |
33 class AnalysisCanvas; | 34 class AnalysisCanvas; |
34 } | 35 } |
35 | 36 |
36 namespace cc { | 37 namespace cc { |
37 | 38 |
38 class ContentLayerClient; | 39 class ContentLayerClient; |
39 | 40 |
40 class CC_EXPORT Picture | 41 class CC_EXPORT Picture |
41 : public base::RefCountedThreadSafe<Picture> { | 42 : public base::RefCountedThreadSafe<Picture> { |
42 public: | 43 public: |
43 typedef std::pair<int, int> PixelRefMapKey; | 44 typedef std::pair<int, int> PixelRefMapKey; |
44 typedef std::vector<SkPixelRef*> PixelRefs; | 45 typedef std::vector<SkPixelRef*> PixelRefs; |
45 typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; | 46 typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; |
46 | 47 |
47 enum RecordingMode { | 48 enum RecordingMode { |
48 RECORD_NORMALLY, | 49 RECORD_NORMALLY, |
49 RECORD_WITH_SK_NULL_CANVAS, | 50 RECORD_WITH_SK_NULL_CANVAS, |
50 RECORD_WITH_PAINTING_DISABLED, | 51 RECORD_WITH_PAINTING_DISABLED, |
| 52 RECORD_WITH_SKRECORD, |
51 RECORDING_MODE_COUNT, // Must be the last entry. | 53 RECORDING_MODE_COUNT, // Must be the last entry. |
52 }; | 54 }; |
53 | 55 |
54 static scoped_refptr<Picture> Create( | 56 static scoped_refptr<Picture> Create( |
55 const gfx::Rect& layer_rect, | 57 const gfx::Rect& layer_rect, |
56 ContentLayerClient* client, | 58 ContentLayerClient* client, |
57 const SkTileGridPicture::TileGridInfo& tile_grid_info, | 59 const SkTileGridPicture::TileGridInfo& tile_grid_info, |
58 bool gather_pixels_refs, | 60 bool gather_pixels_refs, |
59 int num_raster_threads, | 61 int num_raster_threads, |
60 RecordingMode recording_mode); | 62 RecordingMode recording_mode); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 void Record(ContentLayerClient* client, | 150 void Record(ContentLayerClient* client, |
149 const SkTileGridPicture::TileGridInfo& tile_grid_info, | 151 const SkTileGridPicture::TileGridInfo& tile_grid_info, |
150 RecordingMode recording_mode); | 152 RecordingMode recording_mode); |
151 | 153 |
152 // Gather pixel refs from recording. | 154 // Gather pixel refs from recording. |
153 void GatherPixelRefs(const SkTileGridPicture::TileGridInfo& tile_grid_info); | 155 void GatherPixelRefs(const SkTileGridPicture::TileGridInfo& tile_grid_info); |
154 | 156 |
155 gfx::Rect layer_rect_; | 157 gfx::Rect layer_rect_; |
156 gfx::Rect opaque_rect_; | 158 gfx::Rect opaque_rect_; |
157 skia::RefPtr<SkPicture> picture_; | 159 skia::RefPtr<SkPicture> picture_; |
| 160 scoped_ptr<const EXPERIMENTAL::SkPlayback> playback_; |
158 | 161 |
159 typedef std::vector<scoped_refptr<Picture> > PictureVector; | 162 typedef std::vector<scoped_refptr<Picture> > PictureVector; |
160 PictureVector clones_; | 163 PictureVector clones_; |
161 | 164 |
162 PixelRefMap pixel_refs_; | 165 PixelRefMap pixel_refs_; |
163 gfx::Point min_pixel_cell_; | 166 gfx::Point min_pixel_cell_; |
164 gfx::Point max_pixel_cell_; | 167 gfx::Point max_pixel_cell_; |
165 gfx::Size cell_size_; | 168 gfx::Size cell_size_; |
166 | 169 |
167 scoped_refptr<base::debug::ConvertableToTraceFormat> | 170 scoped_refptr<base::debug::ConvertableToTraceFormat> |
168 AsTraceableRasterData(float scale) const; | 171 AsTraceableRasterData(float scale) const; |
169 scoped_refptr<base::debug::ConvertableToTraceFormat> | 172 scoped_refptr<base::debug::ConvertableToTraceFormat> |
170 AsTraceableRecordData() const; | 173 AsTraceableRecordData() const; |
171 | 174 |
172 base::ThreadChecker raster_thread_checker_; | 175 base::ThreadChecker raster_thread_checker_; |
173 | 176 |
174 friend class base::RefCountedThreadSafe<Picture>; | 177 friend class base::RefCountedThreadSafe<Picture>; |
175 friend class PixelRefIterator; | 178 friend class PixelRefIterator; |
176 DISALLOW_COPY_AND_ASSIGN(Picture); | 179 DISALLOW_COPY_AND_ASSIGN(Picture); |
177 }; | 180 }; |
178 | 181 |
179 } // namespace cc | 182 } // namespace cc |
180 | 183 |
181 #endif // CC_RESOURCES_PICTURE_H_ | 184 #endif // CC_RESOURCES_PICTURE_H_ |
OLD | NEW |