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

Side by Side Diff: cc/playback/display_item_list.cc

Issue 1869753003: Replace many skia::RefPtr with sk_sp<> in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Florin's nits Created 4 years, 7 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/playback/display_item_list.h ('k') | cc/playback/display_item_list_unittest.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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 LargestDisplayItemSize() * kDefaultNumDisplayItemsToReserve), 82 LargestDisplayItemSize() * kDefaultNumDisplayItemsToReserve),
83 settings_(settings), 83 settings_(settings),
84 retain_individual_display_items_(retain_individual_display_items), 84 retain_individual_display_items_(retain_individual_display_items),
85 layer_rect_(layer_rect), 85 layer_rect_(layer_rect),
86 is_suitable_for_gpu_rasterization_(true), 86 is_suitable_for_gpu_rasterization_(true),
87 approximate_op_count_(0), 87 approximate_op_count_(0),
88 picture_memory_usage_(0) { 88 picture_memory_usage_(0) {
89 if (settings_.use_cached_picture) { 89 if (settings_.use_cached_picture) {
90 SkRTreeFactory factory; 90 SkRTreeFactory factory;
91 recorder_.reset(new SkPictureRecorder()); 91 recorder_.reset(new SkPictureRecorder());
92 canvas_ = skia::SharePtr(recorder_->beginRecording( 92
93 // TODO(fmalita): this is fragile, we should drop canvas_ and use
94 // recorder_->getCanvas() instead.
95 canvas_ = sk_ref_sp(recorder_->beginRecording(
93 layer_rect_.width(), layer_rect_.height(), &factory)); 96 layer_rect_.width(), layer_rect_.height(), &factory));
94 canvas_->translate(-layer_rect_.x(), -layer_rect_.y()); 97 canvas_->translate(-layer_rect_.x(), -layer_rect_.y());
95 canvas_->clipRect(gfx::RectToSkRect(layer_rect_)); 98 canvas_->clipRect(gfx::RectToSkRect(layer_rect_));
96 } 99 }
97 } 100 }
98 101
99 DisplayItemList::~DisplayItemList() { 102 DisplayItemList::~DisplayItemList() {
100 } 103 }
101 104
102 void DisplayItemList::ToProtobuf( 105 void DisplayItemList::ToProtobuf(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 185
183 if (settings_.use_cached_picture) { 186 if (settings_.use_cached_picture) {
184 // Convert to an SkPicture for faster rasterization. 187 // Convert to an SkPicture for faster rasterization.
185 DCHECK(settings_.use_cached_picture); 188 DCHECK(settings_.use_cached_picture);
186 DCHECK(!picture_); 189 DCHECK(!picture_);
187 picture_ = recorder_->finishRecordingAsPicture(); 190 picture_ = recorder_->finishRecordingAsPicture();
188 DCHECK(picture_); 191 DCHECK(picture_);
189 picture_memory_usage_ = 192 picture_memory_usage_ =
190 SkPictureUtils::ApproximateBytesUsed(picture_.get()); 193 SkPictureUtils::ApproximateBytesUsed(picture_.get());
191 recorder_.reset(); 194 recorder_.reset();
192 canvas_.clear(); 195 canvas_.reset();
193 is_suitable_for_gpu_rasterization_ = 196 is_suitable_for_gpu_rasterization_ =
194 picture_->suitableForGpuRasterization(nullptr); 197 picture_->suitableForGpuRasterization(nullptr);
195 } 198 }
196 } 199 }
197 200
198 bool DisplayItemList::IsSuitableForGpuRasterization() const { 201 bool DisplayItemList::IsSuitableForGpuRasterization() const {
199 return is_suitable_for_gpu_rasterization_; 202 return is_suitable_for_gpu_rasterization_;
200 } 203 }
201 204
202 int DisplayItemList::ApproximateOpCount() const { 205 int DisplayItemList::ApproximateOpCount() const {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 305 }
303 306
304 void DisplayItemList::GetDiscardableImagesInRect( 307 void DisplayItemList::GetDiscardableImagesInRect(
305 const gfx::Rect& rect, 308 const gfx::Rect& rect,
306 float raster_scale, 309 float raster_scale,
307 std::vector<DrawImage>* images) { 310 std::vector<DrawImage>* images) {
308 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); 311 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images);
309 } 312 }
310 313
311 } // namespace cc 314 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/display_item_list.h ('k') | cc/playback/display_item_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698