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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 const gfx::Rect& layer_rect, | 169 const gfx::Rect& layer_rect, |
170 const PixelRefMap& pixel_refs) : | 170 const PixelRefMap& pixel_refs) : |
171 layer_rect_(layer_rect), | 171 layer_rect_(layer_rect), |
172 picture_(picture), | 172 picture_(picture), |
173 pixel_refs_(pixel_refs), | 173 pixel_refs_(pixel_refs), |
174 cell_size_(layer_rect.size()) { | 174 cell_size_(layer_rect.size()) { |
175 } | 175 } |
176 | 176 |
177 Picture::~Picture() { | 177 Picture::~Picture() { |
178 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 178 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
179 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this); | 179 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture"), "cc::Picture", this); |
180 } | 180 } |
181 | 181 |
182 bool Picture::IsSuitableForGpuRasterization(const char** reason) const { | 182 bool Picture::IsSuitableForGpuRasterization(const char** reason) const { |
183 DCHECK(picture_); | 183 DCHECK(picture_); |
184 | 184 |
185 // TODO(hendrikw): SkPicture::suitableForGpuRasterization takes a GrContext. | 185 // TODO(hendrikw): SkPicture::suitableForGpuRasterization takes a GrContext. |
186 // Currently the GrContext isn't used, and should probably be removed from | 186 // Currently the GrContext isn't used, and should probably be removed from |
187 // skia. | 187 // skia. |
188 return picture_->suitableForGpuRasterization(nullptr, reason); | 188 return picture_->suitableForGpuRasterization(nullptr, reason); |
189 } | 189 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 stream.copyTo(serialized_picture.get()); | 383 stream.copyTo(serialized_picture.get()); |
384 std::string b64_picture; | 384 std::string b64_picture; |
385 base::Base64Encode(std::string(serialized_picture.get(), serialized_size), | 385 base::Base64Encode(std::string(serialized_picture.get(), serialized_size), |
386 &b64_picture); | 386 &b64_picture); |
387 res->SetString("skp64", b64_picture); | 387 res->SetString("skp64", b64_picture); |
388 return res.Pass(); | 388 return res.Pass(); |
389 } | 389 } |
390 | 390 |
391 void Picture::EmitTraceSnapshot() const { | 391 void Picture::EmitTraceSnapshot() const { |
392 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 392 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
393 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( | 393 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," |
394 "devtools.timeline.picture"), | 394 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"), |
395 "cc::Picture", | 395 "cc::Picture", |
396 this, | 396 this, |
397 TracedPicture::AsTraceablePicture(this)); | 397 TracedPicture::AsTraceablePicture(this)); |
398 } | 398 } |
399 | 399 |
400 void Picture::EmitTraceSnapshotAlias(Picture* original) const { | 400 void Picture::EmitTraceSnapshotAlias(Picture* original) const { |
401 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 401 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
402 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( | 402 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," |
403 "devtools.timeline.picture"), | 403 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"), |
404 "cc::Picture", | 404 "cc::Picture", |
405 this, | 405 this, |
406 TracedPicture::AsTraceablePictureAlias(original)); | 406 TracedPicture::AsTraceablePictureAlias(original)); |
407 } | 407 } |
408 | 408 |
409 base::LazyInstance<Picture::PixelRefs> | 409 base::LazyInstance<Picture::PixelRefs> |
410 Picture::PixelRefIterator::empty_pixel_refs_; | 410 Picture::PixelRefIterator::empty_pixel_refs_; |
411 | 411 |
412 Picture::PixelRefIterator::PixelRefIterator() | 412 Picture::PixelRefIterator::PixelRefIterator() |
413 : picture_(NULL), | 413 : picture_(NULL), |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 scoped_refptr<base::debug::TracedValue> record_data = | 520 scoped_refptr<base::debug::TracedValue> record_data = |
521 new base::debug::TracedValue(); | 521 new base::debug::TracedValue(); |
522 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); | 522 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); |
523 record_data->BeginArray("layer_rect"); | 523 record_data->BeginArray("layer_rect"); |
524 MathUtil::AddToTracedValue(layer_rect_, record_data.get()); | 524 MathUtil::AddToTracedValue(layer_rect_, record_data.get()); |
525 record_data->EndArray(); | 525 record_data->EndArray(); |
526 return record_data; | 526 return record_data; |
527 } | 527 } |
528 | 528 |
529 } // namespace cc | 529 } // namespace cc |
OLD | NEW |