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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 enum RecordingMode { | 47 enum RecordingMode { |
48 RECORD_NORMALLY, | 48 RECORD_NORMALLY, |
49 RECORD_WITH_SK_NULL_CANVAS, | 49 RECORD_WITH_SK_NULL_CANVAS, |
50 RECORD_WITH_PAINTING_DISABLED, | 50 RECORD_WITH_PAINTING_DISABLED, |
51 RECORDING_MODE_COUNT, // Must be the last entry. | 51 RECORDING_MODE_COUNT, // Must be the last entry. |
52 }; | 52 }; |
53 | 53 |
54 static scoped_refptr<Picture> Create( | 54 static scoped_refptr<Picture> Create( |
55 const gfx::Rect& layer_rect, | 55 const gfx::Rect& layer_rect, |
56 ContentLayerClient* client, | 56 ContentLayerClient* client, |
| 57 bool can_use_lcd_text, |
| 58 bool contents_opaque, |
57 const SkTileGridFactory::TileGridInfo& tile_grid_info, | 59 const SkTileGridFactory::TileGridInfo& tile_grid_info, |
58 bool gather_pixels_refs, | 60 bool gather_pixels_refs, |
59 RecordingMode recording_mode); | 61 RecordingMode recording_mode); |
60 static scoped_refptr<Picture> CreateFromValue(const base::Value* value); | 62 static scoped_refptr<Picture> CreateFromValue(const base::Value* value); |
61 static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); | 63 static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); |
62 | 64 |
63 gfx::Rect LayerRect() const { return layer_rect_; } | 65 gfx::Rect LayerRect() const { return layer_rect_; } |
64 | 66 |
65 // Has Record() been called yet? | 67 // Has Record() been called yet? |
66 bool HasRecording() const { return picture_.get() != NULL; } | 68 bool HasRecording() const { return picture_.get() != NULL; } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 Picture(const skia::RefPtr<SkPicture>&, | 135 Picture(const skia::RefPtr<SkPicture>&, |
134 const gfx::Rect& layer_rect, | 136 const gfx::Rect& layer_rect, |
135 const PixelRefMap& pixel_refs); | 137 const PixelRefMap& pixel_refs); |
136 // This constructor will call AdoptRef on the SkPicture. | 138 // This constructor will call AdoptRef on the SkPicture. |
137 Picture(SkPicture*, const gfx::Rect& layer_rect); | 139 Picture(SkPicture*, const gfx::Rect& layer_rect); |
138 ~Picture(); | 140 ~Picture(); |
139 | 141 |
140 // Record a paint operation. To be able to safely use this SkPicture for | 142 // Record a paint operation. To be able to safely use this SkPicture for |
141 // playback on a different thread this can only be called once. | 143 // playback on a different thread this can only be called once. |
142 void Record(ContentLayerClient* client, | 144 void Record(ContentLayerClient* client, |
| 145 bool can_use_lcd_text, |
| 146 bool contents_opaque, |
143 const SkTileGridFactory::TileGridInfo& tile_grid_info, | 147 const SkTileGridFactory::TileGridInfo& tile_grid_info, |
144 RecordingMode recording_mode); | 148 RecordingMode recording_mode); |
145 | 149 |
146 // Gather pixel refs from recording. | 150 // Gather pixel refs from recording. |
147 void GatherPixelRefs(const SkTileGridFactory::TileGridInfo& tile_grid_info); | 151 void GatherPixelRefs(const SkTileGridFactory::TileGridInfo& tile_grid_info); |
148 | 152 |
149 gfx::Rect layer_rect_; | 153 gfx::Rect layer_rect_; |
150 skia::RefPtr<SkPicture> picture_; | 154 skia::RefPtr<SkPicture> picture_; |
151 | 155 |
152 PixelRefMap pixel_refs_; | 156 PixelRefMap pixel_refs_; |
153 gfx::Point min_pixel_cell_; | 157 gfx::Point min_pixel_cell_; |
154 gfx::Point max_pixel_cell_; | 158 gfx::Point max_pixel_cell_; |
155 gfx::Size cell_size_; | 159 gfx::Size cell_size_; |
156 | 160 |
157 scoped_refptr<base::debug::ConvertableToTraceFormat> | 161 scoped_refptr<base::debug::ConvertableToTraceFormat> |
158 AsTraceableRasterData(float scale) const; | 162 AsTraceableRasterData(float scale) const; |
159 scoped_refptr<base::debug::ConvertableToTraceFormat> | 163 scoped_refptr<base::debug::ConvertableToTraceFormat> |
160 AsTraceableRecordData() const; | 164 AsTraceableRecordData() const; |
161 | 165 |
162 friend class base::RefCountedThreadSafe<Picture>; | 166 friend class base::RefCountedThreadSafe<Picture>; |
163 friend class PixelRefIterator; | 167 friend class PixelRefIterator; |
164 DISALLOW_COPY_AND_ASSIGN(Picture); | 168 DISALLOW_COPY_AND_ASSIGN(Picture); |
165 }; | 169 }; |
166 | 170 |
167 } // namespace cc | 171 } // namespace cc |
168 | 172 |
169 #endif // CC_RESOURCES_PICTURE_H_ | 173 #endif // CC_RESOURCES_PICTURE_H_ |
OLD | NEW |