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 "cc/resources/picture.h" | 5 #include "cc/resources/picture.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 picture_(picture), | 168 picture_(picture), |
169 pixel_refs_(pixel_refs), | 169 pixel_refs_(pixel_refs), |
170 cell_size_(layer_rect.size()) { | 170 cell_size_(layer_rect.size()) { |
171 } | 171 } |
172 | 172 |
173 Picture::~Picture() { | 173 Picture::~Picture() { |
174 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 174 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
175 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this); | 175 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this); |
176 } | 176 } |
177 | 177 |
178 bool Picture::IsSuitableForGpuRasterization() const { | 178 bool Picture::IsSuitableForGpuRasterization(const char** reason) const { |
179 DCHECK(picture_); | 179 DCHECK(picture_); |
180 | 180 |
181 // TODO(alokp): SkPicture::suitableForGpuRasterization needs a GrContext. | 181 // TODO(hendrikw): SkPicture::suitableForGpuRasterization takes a GrContext. |
182 // Ideally this GrContext should be the same as that for rasterizing this | 182 // Currently the GrContext isn't used, and should probably be removed from |
183 // picture. But we are on the main thread while the rasterization context | 183 // skia. |
184 // may be on the compositor or raster thread. | 184 return picture_->suitableForGpuRasterization(nullptr, reason); |
185 // SkPicture::suitableForGpuRasterization is not implemented yet. | |
186 // Pass a NULL context for now and discuss with skia folks if the context | |
187 // is really needed. | |
188 return picture_->suitableForGpuRasterization(NULL); | |
189 } | 185 } |
190 | 186 |
191 int Picture::ApproximateOpCount() const { | 187 int Picture::ApproximateOpCount() const { |
192 DCHECK(picture_); | 188 DCHECK(picture_); |
193 return picture_->approximateOpCount(); | 189 return picture_->approximateOpCount(); |
194 } | 190 } |
195 | 191 |
196 size_t Picture::ApproximateMemoryUsage() const { | 192 size_t Picture::ApproximateMemoryUsage() const { |
197 DCHECK(picture_); | 193 DCHECK(picture_); |
198 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); | 194 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 scoped_refptr<base::debug::TracedValue> record_data = | 515 scoped_refptr<base::debug::TracedValue> record_data = |
520 new base::debug::TracedValue(); | 516 new base::debug::TracedValue(); |
521 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); | 517 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); |
522 record_data->BeginArray("layer_rect"); | 518 record_data->BeginArray("layer_rect"); |
523 MathUtil::AddToTracedValue(layer_rect_, record_data.get()); | 519 MathUtil::AddToTracedValue(layer_rect_, record_data.get()); |
524 record_data->EndArray(); | 520 record_data->EndArray(); |
525 return record_data; | 521 return record_data; |
526 } | 522 } |
527 | 523 |
528 } // namespace cc | 524 } // namespace cc |
OLD | NEW |