| 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> |
| 8 |
| 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/trace_event/trace_event_argument.h" |
| 11 #include "cc/debug/picture_debug_util.h" |
| 7 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
| 8 #include "third_party/skia/include/core/SkDrawPictureCallback.h" | 13 #include "third_party/skia/include/core/SkDrawPictureCallback.h" |
| 9 #include "third_party/skia/include/core/SkMatrix.h" | 14 #include "third_party/skia/include/core/SkMatrix.h" |
| 10 #include "third_party/skia/include/core/SkPicture.h" | 15 #include "third_party/skia/include/core/SkPicture.h" |
| 11 #include "third_party/skia/include/utils/SkPictureUtils.h" | 16 #include "third_party/skia/include/utils/SkPictureUtils.h" |
| 12 | 17 |
| 13 namespace cc { | 18 namespace cc { |
| 14 | 19 |
| 15 DrawingDisplayItem::DrawingDisplayItem(skia::RefPtr<SkPicture> picture, | 20 DrawingDisplayItem::DrawingDisplayItem(skia::RefPtr<SkPicture> picture, |
| 16 gfx::PointF location) | 21 gfx::PointF location) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 54 |
| 50 int DrawingDisplayItem::ApproximateOpCount() const { | 55 int DrawingDisplayItem::ApproximateOpCount() const { |
| 51 return picture_->approximateOpCount() + sizeof(gfx::PointF); | 56 return picture_->approximateOpCount() + sizeof(gfx::PointF); |
| 52 } | 57 } |
| 53 | 58 |
| 54 size_t DrawingDisplayItem::PictureMemoryUsage() const { | 59 size_t DrawingDisplayItem::PictureMemoryUsage() const { |
| 55 DCHECK(picture_); | 60 DCHECK(picture_); |
| 56 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); | 61 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); |
| 57 } | 62 } |
| 58 | 63 |
| 64 void DrawingDisplayItem::AsValueInto(base::debug::TracedValue* array) const { |
| 65 array->BeginDictionary(); |
| 66 array->SetString("name", "DrawingDisplayItem"); |
| 67 array->SetString("location", |
| 68 base::StringPrintf("[%f,%f]", picture_->cullRect().x(), |
| 69 picture_->cullRect().y())); |
| 70 std::string b64_picture; |
| 71 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture); |
| 72 array->SetString("skp64", b64_picture); |
| 73 array->EndDictionary(); |
| 74 } |
| 75 |
| 59 } // namespace cc | 76 } // namespace cc |
| OLD | NEW |