Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 class CC_EXPORT Picture | 41 class CC_EXPORT Picture |
| 42 : public base::RefCountedThreadSafe<Picture> { | 42 : public base::RefCountedThreadSafe<Picture> { |
| 43 public: | 43 public: |
| 44 typedef std::pair<int, int> PixelRefMapKey; | 44 typedef std::pair<int, int> PixelRefMapKey; |
| 45 typedef std::vector<SkPixelRef*> PixelRefs; | 45 typedef std::vector<SkPixelRef*> PixelRefs; |
| 46 typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; | 46 typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; |
| 47 | 47 |
| 48 enum RecordingMode { | 48 enum RecordingMode { |
| 49 RECORD_NORMALLY, | 49 RECORD_NORMALLY, |
| 50 RECORD_WITH_SK_NULL_CANVAS, | 50 RECORD_WITH_SK_nullptr_CANVAS, |
|
danakj
2014/10/10 17:03:22
undo this
| |
| 51 RECORD_WITH_PAINTING_DISABLED, | 51 RECORD_WITH_PAINTING_DISABLED, |
| 52 RECORD_WITH_SKRECORD, | 52 RECORD_WITH_SKRECORD, |
| 53 RECORDING_MODE_COUNT, // Must be the last entry. | 53 RECORDING_MODE_COUNT, // Must be the last entry. |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 static scoped_refptr<Picture> Create( | 56 static scoped_refptr<Picture> Create( |
| 57 const gfx::Rect& layer_rect, | 57 const gfx::Rect& layer_rect, |
| 58 ContentLayerClient* client, | 58 ContentLayerClient* client, |
| 59 const SkTileGridFactory::TileGridInfo& tile_grid_info, | 59 const SkTileGridFactory::TileGridInfo& tile_grid_info, |
| 60 bool gather_pixels_refs, | 60 bool gather_pixels_refs, |
| 61 RecordingMode recording_mode); | 61 RecordingMode recording_mode); |
| 62 static scoped_refptr<Picture> CreateFromValue(const base::Value* value); | 62 static scoped_refptr<Picture> CreateFromValue(const base::Value* value); |
| 63 static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); | 63 static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); |
| 64 | 64 |
| 65 gfx::Rect LayerRect() const { return layer_rect_; } | 65 gfx::Rect LayerRect() const { return layer_rect_; } |
| 66 | 66 |
| 67 // Has Record() been called yet? | 67 // Has Record() been called yet? |
| 68 bool HasRecording() const { return picture_.get() != NULL; } | 68 bool HasRecording() const { return picture_.get() != nullptr; } |
| 69 | 69 |
| 70 bool IsSuitableForGpuRasterization() const; | 70 bool IsSuitableForGpuRasterization() const; |
| 71 int ApproximateOpCount() const; | 71 int ApproximateOpCount() const; |
| 72 | 72 |
| 73 bool HasText() const; | 73 bool HasText() const; |
| 74 | 74 |
| 75 // Apply this scale and raster the negated region into the canvas. | 75 // Apply this scale and raster the negated region into the canvas. |
| 76 // |negated_content_region| specifies the region to be clipped out of the | 76 // |negated_content_region| specifies the region to be clipped out of the |
| 77 // raster operation, i.e., the parts of the canvas which will not get drawn | 77 // raster operation, i.e., the parts of the canvas which will not get drawn |
| 78 // to. | 78 // to. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 AsTraceableRecordData() const; | 163 AsTraceableRecordData() const; |
| 164 | 164 |
| 165 friend class base::RefCountedThreadSafe<Picture>; | 165 friend class base::RefCountedThreadSafe<Picture>; |
| 166 friend class PixelRefIterator; | 166 friend class PixelRefIterator; |
| 167 DISALLOW_COPY_AND_ASSIGN(Picture); | 167 DISALLOW_COPY_AND_ASSIGN(Picture); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 } // namespace cc | 170 } // namespace cc |
| 171 | 171 |
| 172 #endif // CC_RESOURCES_PICTURE_H_ | 172 #endif // CC_RESOURCES_PICTURE_H_ |
| OLD | NEW |