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