Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Side by Side Diff: cc/resources/picture_pile_impl.cc

Issue 1066273002: Use SkPictureRecorder::endRecordingAsPicture() instead of endRecording() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/skpicture_content_layer_updater.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/skpicture_content_layer_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698