| 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/resources/drawing_display_item.h" | 5 #include "cc/resources/drawing_display_item.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 int DrawingDisplayItem::ApproximateOpCount() const { | 56 int DrawingDisplayItem::ApproximateOpCount() const { |
| 57 return picture_->approximateOpCount() + sizeof(gfx::PointF); | 57 return picture_->approximateOpCount() + sizeof(gfx::PointF); |
| 58 } | 58 } |
| 59 | 59 |
| 60 size_t DrawingDisplayItem::PictureMemoryUsage() const { | 60 size_t DrawingDisplayItem::PictureMemoryUsage() const { |
| 61 DCHECK(picture_); | 61 DCHECK(picture_); |
| 62 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); | 62 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DrawingDisplayItem::AsValueInto(base::debug::TracedValue* array) const { | 65 void DrawingDisplayItem::AsValueInto( |
| 66 base::trace_event::TracedValue* array) const { |
| 66 array->BeginDictionary(); | 67 array->BeginDictionary(); |
| 67 array->SetString("name", "DrawingDisplayItem"); | 68 array->SetString("name", "DrawingDisplayItem"); |
| 68 array->SetString("location", | 69 array->SetString("location", |
| 69 base::StringPrintf("[%f,%f]", picture_->cullRect().x(), | 70 base::StringPrintf("[%f,%f]", picture_->cullRect().x(), |
| 70 picture_->cullRect().y())); | 71 picture_->cullRect().y())); |
| 71 std::string b64_picture; | 72 std::string b64_picture; |
| 72 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture); | 73 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture); |
| 73 array->SetString("skp64", b64_picture); | 74 array->SetString("skp64", b64_picture); |
| 74 array->EndDictionary(); | 75 array->EndDictionary(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 } // namespace cc | 78 } // namespace cc |
| OLD | NEW |