| 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/playback/drawing_display_item.h" | 5 #include "cc/playback/drawing_display_item.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "base/trace_event/trace_event_argument.h" | 13 #include "base/trace_event/trace_event_argument.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "cc/debug/picture_debug_util.h" | 15 #include "cc/debug/picture_debug_util.h" |
| 16 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
| 17 #include "third_party/skia/include/utils/SkPictureUtils.h" | 17 #include "third_party/skia/include/utils/SkPictureUtils.h" |
| 18 #include "ui/gfx/skia_util.h" | 18 #include "ui/gfx/skia_util.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 DrawingDisplayItem::DrawingDisplayItem() : DisplayItem(DRAWING) {} | 22 DrawingDisplayItem::DrawingDisplayItem() : DisplayItem(DRAWING) {} |
| 23 | 23 |
| 24 DrawingDisplayItem::DrawingDisplayItem(sk_sp<const PaintRecord> picture) | 24 DrawingDisplayItem::DrawingDisplayItem(sk_sp<const PaintRecord> record) |
| 25 : DisplayItem(DRAWING) { | 25 : DisplayItem(DRAWING) { |
| 26 SetNew(std::move(picture)); | 26 SetNew(std::move(record)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 DrawingDisplayItem::DrawingDisplayItem(const DrawingDisplayItem& item) | 29 DrawingDisplayItem::DrawingDisplayItem(const DrawingDisplayItem& item) |
| 30 : DisplayItem(DRAWING) { | 30 : DisplayItem(DRAWING) { |
| 31 item.CloneTo(this); | 31 item.CloneTo(this); |
| 32 } | 32 } |
| 33 | 33 |
| 34 DrawingDisplayItem::~DrawingDisplayItem() { | 34 DrawingDisplayItem::~DrawingDisplayItem() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 void DrawingDisplayItem::SetNew(sk_sp<const PaintRecord> picture) { | 37 void DrawingDisplayItem::SetNew(sk_sp<const PaintRecord> record) { |
| 38 picture_ = std::move(picture); | 38 picture_ = std::move(record); |
| 39 } | 39 } |
| 40 | 40 |
| 41 DISABLE_CFI_PERF | 41 DISABLE_CFI_PERF |
| 42 void DrawingDisplayItem::Raster(SkCanvas* canvas, | 42 void DrawingDisplayItem::Raster(SkCanvas* canvas, |
| 43 SkPicture::AbortCallback* callback) const { | 43 SkPicture::AbortCallback* callback) const { |
| 44 if (canvas->quickReject(picture_->cullRect())) | 44 if (canvas->quickReject(picture_->cullRect())) |
| 45 return; | 45 return; |
| 46 | 46 |
| 47 // SkPicture always does a wrapping save/restore on the canvas, so it is not | 47 // SkPicture always does a wrapping save/restore on the canvas, so it is not |
| 48 // necessary here. | 48 // necessary here. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 size_t DrawingDisplayItem::ExternalMemoryUsage() const { | 85 size_t DrawingDisplayItem::ExternalMemoryUsage() const { |
| 86 return SkPictureUtils::ApproximateBytesUsed(ToSkPicture(picture_.get())); | 86 return SkPictureUtils::ApproximateBytesUsed(ToSkPicture(picture_.get())); |
| 87 } | 87 } |
| 88 | 88 |
| 89 DISABLE_CFI_PERF | 89 DISABLE_CFI_PERF |
| 90 int DrawingDisplayItem::ApproximateOpCount() const { | 90 int DrawingDisplayItem::ApproximateOpCount() const { |
| 91 return picture_->approximateOpCount(); | 91 return picture_->approximateOpCount(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace cc | 94 } // namespace cc |
| OLD | NEW |