| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <limits> | 6 #include <limits> |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/base/region.h" | 10 #include "cc/base/region.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { | 251 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
| 252 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); | 252 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); |
| 253 | 253 |
| 254 gfx::Rect tiling_rect(tiling_.tiling_size()); | 254 gfx::Rect tiling_rect(tiling_.tiling_size()); |
| 255 SkPictureRecorder recorder; | 255 SkPictureRecorder recorder; |
| 256 SkCanvas* canvas = | 256 SkCanvas* canvas = |
| 257 recorder.beginRecording(tiling_rect.width(), tiling_rect.height()); | 257 recorder.beginRecording(tiling_rect.width(), tiling_rect.height()); |
| 258 if (!tiling_rect.IsEmpty()) | 258 if (!tiling_rect.IsEmpty()) |
| 259 PlaybackToCanvas(canvas, tiling_rect, 1.0); | 259 PlaybackToCanvas(canvas, tiling_rect, 1.0); |
| 260 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 260 skia::RefPtr<SkPicture> picture = |
| 261 skia::AdoptRef(recorder.endRecordingAsPicture()); |
| 261 | 262 |
| 262 return picture; | 263 return picture; |
| 263 } | 264 } |
| 264 | 265 |
| 265 size_t PicturePileImpl::GetPictureMemoryUsage() const { | 266 size_t PicturePileImpl::GetPictureMemoryUsage() const { |
| 266 // Place all pictures in a set to de-dupe. | 267 // Place all pictures in a set to de-dupe. |
| 267 size_t total_size = 0; | 268 size_t total_size = 0; |
| 268 std::set<const Picture*> pictures_seen; | 269 std::set<const Picture*> pictures_seen; |
| 269 for (const auto& map_value : picture_map_) { | 270 for (const auto& map_value : picture_map_) { |
| 270 const Picture* picture = map_value.second.get(); | 271 const Picture* picture = map_value.second.get(); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 for (const auto& map_pair : picture_map_) { | 453 for (const auto& map_pair : picture_map_) { |
| 453 const Picture* picture = map_pair.second.get(); | 454 const Picture* picture = map_pair.second.get(); |
| 454 if (processed_pictures.count(picture) == 0) { | 455 if (processed_pictures.count(picture) == 0) { |
| 455 picture->EmitTraceSnapshot(); | 456 picture->EmitTraceSnapshot(); |
| 456 processed_pictures.insert(picture); | 457 processed_pictures.insert(picture); |
| 457 } | 458 } |
| 458 } | 459 } |
| 459 } | 460 } |
| 460 | 461 |
| 461 } // namespace cc | 462 } // namespace cc |
| OLD | NEW |