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