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 <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 Loading... | |
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 canvas_ = sk_ref_sp(recorder_->beginRecording( |
f(malita)
2016/04/21 15:45:47
(note to self, maybe add a TODO(fmalita)?)
Tracki
tomhudson
2016/04/25 20:20:51
Acknowledged.
| |
93 layer_rect_.width(), layer_rect_.height(), &factory)); | 93 layer_rect_.width(), layer_rect_.height(), &factory)); |
94 canvas_->translate(-layer_rect_.x(), -layer_rect_.y()); | 94 canvas_->translate(-layer_rect_.x(), -layer_rect_.y()); |
95 canvas_->clipRect(gfx::RectToSkRect(layer_rect_)); | 95 canvas_->clipRect(gfx::RectToSkRect(layer_rect_)); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 DisplayItemList::~DisplayItemList() { | 99 DisplayItemList::~DisplayItemList() { |
100 } | 100 } |
101 | 101 |
102 void DisplayItemList::ToProtobuf( | 102 void DisplayItemList::ToProtobuf( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 | 182 |
183 if (settings_.use_cached_picture) { | 183 if (settings_.use_cached_picture) { |
184 // Convert to an SkPicture for faster rasterization. | 184 // Convert to an SkPicture for faster rasterization. |
185 DCHECK(settings_.use_cached_picture); | 185 DCHECK(settings_.use_cached_picture); |
186 DCHECK(!picture_); | 186 DCHECK(!picture_); |
187 picture_ = recorder_->finishRecordingAsPicture(); | 187 picture_ = recorder_->finishRecordingAsPicture(); |
188 DCHECK(picture_); | 188 DCHECK(picture_); |
189 picture_memory_usage_ = | 189 picture_memory_usage_ = |
190 SkPictureUtils::ApproximateBytesUsed(picture_.get()); | 190 SkPictureUtils::ApproximateBytesUsed(picture_.get()); |
191 recorder_.reset(); | 191 recorder_.reset(); |
192 canvas_.clear(); | 192 canvas_.reset(); |
193 is_suitable_for_gpu_rasterization_ = | 193 is_suitable_for_gpu_rasterization_ = |
194 picture_->suitableForGpuRasterization(nullptr); | 194 picture_->suitableForGpuRasterization(nullptr); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 bool DisplayItemList::IsSuitableForGpuRasterization() const { | 198 bool DisplayItemList::IsSuitableForGpuRasterization() const { |
199 return is_suitable_for_gpu_rasterization_; | 199 return is_suitable_for_gpu_rasterization_; |
200 } | 200 } |
201 | 201 |
202 int DisplayItemList::ApproximateOpCount() const { | 202 int DisplayItemList::ApproximateOpCount() const { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 } | 302 } |
303 | 303 |
304 void DisplayItemList::GetDiscardableImagesInRect( | 304 void DisplayItemList::GetDiscardableImagesInRect( |
305 const gfx::Rect& rect, | 305 const gfx::Rect& rect, |
306 float raster_scale, | 306 float raster_scale, |
307 std::vector<DrawImage>* images) { | 307 std::vector<DrawImage>* images) { |
308 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); | 308 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); |
309 } | 309 } |
310 | 310 |
311 } // namespace cc | 311 } // namespace cc |
OLD | NEW |