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