| 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 |
| 11 #include "base/base64.h" | 11 #include "base/base64.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/debug/trace_event_argument.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "cc/base/math_util.h" | 15 #include "cc/base/math_util.h" |
| 15 #include "cc/base/util.h" | 16 #include "cc/base/util.h" |
| 16 #include "cc/debug/traced_picture.h" | 17 #include "cc/debug/traced_picture.h" |
| 17 #include "cc/debug/traced_value.h" | 18 #include "cc/debug/traced_value.h" |
| 18 #include "cc/layers/content_layer_client.h" | 19 #include "cc/layers/content_layer_client.h" |
| 19 #include "skia/ext/pixel_ref_utils.h" | 20 #include "skia/ext/pixel_ref_utils.h" |
| 20 #include "third_party/skia/include/core/SkCanvas.h" | 21 #include "third_party/skia/include/core/SkCanvas.h" |
| 21 #include "third_party/skia/include/core/SkData.h" | 22 #include "third_party/skia/include/core/SkData.h" |
| 22 #include "third_party/skia/include/core/SkDrawFilter.h" | 23 #include "third_party/skia/include/core/SkDrawFilter.h" |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 // We found a non-empty list: store it and get the first pixel ref. | 580 // We found a non-empty list: store it and get the first pixel ref. |
| 580 current_pixel_refs_ = &iter->second; | 581 current_pixel_refs_ = &iter->second; |
| 581 current_index_ = 0; | 582 current_index_ = 0; |
| 582 break; | 583 break; |
| 583 } | 584 } |
| 584 return *this; | 585 return *this; |
| 585 } | 586 } |
| 586 | 587 |
| 587 scoped_refptr<base::debug::ConvertableToTraceFormat> | 588 scoped_refptr<base::debug::ConvertableToTraceFormat> |
| 588 Picture::AsTraceableRasterData(float scale) const { | 589 Picture::AsTraceableRasterData(float scale) const { |
| 589 scoped_ptr<base::DictionaryValue> raster_data(new base::DictionaryValue()); | 590 scoped_refptr<base::debug::TracedValue> raster_data = |
| 590 raster_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); | 591 new base::debug::TracedValue(); |
| 592 TracedValue::SetIDRef(this, raster_data.get(), "picture_id"); |
| 591 raster_data->SetDouble("scale", scale); | 593 raster_data->SetDouble("scale", scale); |
| 592 return TracedValue::FromValue(raster_data.release()); | 594 return raster_data; |
| 593 } | 595 } |
| 594 | 596 |
| 595 scoped_refptr<base::debug::ConvertableToTraceFormat> | 597 scoped_refptr<base::debug::ConvertableToTraceFormat> |
| 596 Picture::AsTraceableRecordData() const { | 598 Picture::AsTraceableRecordData() const { |
| 597 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); | 599 scoped_refptr<base::debug::TracedValue> record_data = |
| 598 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); | 600 new base::debug::TracedValue(); |
| 599 record_data->Set("layer_rect", MathUtil::AsValue(layer_rect_).release()); | 601 TracedValue::SetIDRef(this, record_data.get(), "picture_id"); |
| 600 return TracedValue::FromValue(record_data.release()); | 602 record_data->BeginArray("layer_rect"); |
| 603 MathUtil::AddToTracedValue(layer_rect_, record_data.get()); |
| 604 record_data->EndArray(); |
| 605 return record_data; |
| 601 } | 606 } |
| 602 | 607 |
| 603 } // namespace cc | 608 } // namespace cc |
| OLD | NEW |