OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "cc/playback/display_item_list.h" | 5 #include "cc/playback/display_item_list.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," | 265 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," |
266 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"), | 266 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"), |
267 "cc::DisplayItemList", this, | 267 "cc::DisplayItemList", this, |
268 TracedDisplayItemList::AsTraceableDisplayItemList(this, | 268 TracedDisplayItemList::AsTraceableDisplayItemList(this, |
269 DisplayItemsTracingEnabled())); | 269 DisplayItemsTracingEnabled())); |
270 } | 270 } |
271 | 271 |
272 void DisplayItemList::GenerateDiscardableImagesMetadata() { | 272 void DisplayItemList::GenerateDiscardableImagesMetadata() { |
273 DCHECK(ProcessAppendedItemsCalled()); | 273 DCHECK(ProcessAppendedItemsCalled()); |
274 // This should be only called once, and only after CreateAndCacheSkPicture. | 274 // This should be only called once, and only after CreateAndCacheSkPicture. |
275 DCHECK(picture_); | |
276 DCHECK(image_map_.empty()); | 275 DCHECK(image_map_.empty()); |
277 if (!picture_->willPlayBackBitmaps()) | 276 DCHECK_IMPLIES(use_cached_picture_, picture_); |
| 277 if (use_cached_picture_ && !picture_->willPlayBackBitmaps()) |
278 return; | 278 return; |
279 | 279 |
280 // The cached picture is translated by -layer_rect_.origin during record, | 280 // The cached picture is translated by -layer_rect_.origin during record, |
281 // so we need to offset that back in order to get right positioning for | 281 // so we need to offset that back in order to get right positioning for |
282 // images. | 282 // images. |
283 DiscardableImageMap::ScopedMetadataGenerator generator( | 283 DiscardableImageMap::ScopedMetadataGenerator generator( |
284 &image_map_, gfx::Size(layer_rect_.right(), layer_rect_.bottom())); | 284 &image_map_, gfx::Size(layer_rect_.right(), layer_rect_.bottom())); |
285 generator.canvas()->translate(layer_rect_.x(), layer_rect_.y()); | 285 Raster(generator.canvas(), nullptr, |
286 generator.canvas()->drawPicture(picture_.get()); | 286 gfx::Rect(layer_rect_.right(), layer_rect_.bottom()), 1.f); |
287 } | 287 } |
288 | 288 |
289 void DisplayItemList::GetDiscardableImagesInRect( | 289 void DisplayItemList::GetDiscardableImagesInRect( |
290 const gfx::Rect& rect, | 290 const gfx::Rect& rect, |
291 std::vector<PositionImage>* images) { | 291 std::vector<PositionImage>* images) { |
292 image_map_.GetDiscardableImagesInRect(rect, images); | 292 image_map_.GetDiscardableImagesInRect(rect, images); |
293 } | 293 } |
294 | 294 |
295 } // namespace cc | 295 } // namespace cc |
OLD | NEW |