Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: cc/playback/drawing_display_item.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/playback/drawing_display_item.h ('k') | cc/test/fake_content_layer_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/core/SkData.h"
18 #include "third_party/skia/include/core/SkMatrix.h"
19 #include "third_party/skia/include/core/SkPicture.h"
20 #include "third_party/skia/include/core/SkStream.h"
21 #include "third_party/skia/include/utils/SkPictureUtils.h" 17 #include "third_party/skia/include/utils/SkPictureUtils.h"
22 #include "ui/gfx/skia_util.h" 18 #include "ui/gfx/skia_util.h"
23 19
24 namespace cc { 20 namespace cc {
25 21
26 DrawingDisplayItem::DrawingDisplayItem() : DisplayItem(DRAWING) {} 22 DrawingDisplayItem::DrawingDisplayItem() : DisplayItem(DRAWING) {}
27 23
28 DrawingDisplayItem::DrawingDisplayItem(sk_sp<const SkPicture> picture) 24 DrawingDisplayItem::DrawingDisplayItem(sk_sp<const PaintRecord> picture)
29 : DisplayItem(DRAWING) { 25 : DisplayItem(DRAWING) {
30 SetNew(std::move(picture)); 26 SetNew(std::move(picture));
31 } 27 }
32 28
33 DrawingDisplayItem::DrawingDisplayItem(const DrawingDisplayItem& item) 29 DrawingDisplayItem::DrawingDisplayItem(const DrawingDisplayItem& item)
34 : DisplayItem(DRAWING) { 30 : DisplayItem(DRAWING) {
35 item.CloneTo(this); 31 item.CloneTo(this);
36 } 32 }
37 33
38 DrawingDisplayItem::~DrawingDisplayItem() { 34 DrawingDisplayItem::~DrawingDisplayItem() {
39 } 35 }
40 36
41 void DrawingDisplayItem::SetNew(sk_sp<const SkPicture> picture) { 37 void DrawingDisplayItem::SetNew(sk_sp<const PaintRecord> picture) {
42 picture_ = std::move(picture); 38 picture_ = std::move(picture);
43 } 39 }
44 40
45 DISABLE_CFI_PERF 41 DISABLE_CFI_PERF
46 void DrawingDisplayItem::Raster(SkCanvas* canvas, 42 void DrawingDisplayItem::Raster(SkCanvas* canvas,
47 SkPicture::AbortCallback* callback) const { 43 SkPicture::AbortCallback* callback) const {
48 if (canvas->quickReject(picture_->cullRect())) 44 if (canvas->quickReject(picture_->cullRect()))
49 return; 45 return;
50 46
51 // 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
(...skipping 28 matching lines...) Expand all
80 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture); 76 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture);
81 array->SetString("skp64", b64_picture); 77 array->SetString("skp64", b64_picture);
82 array->EndDictionary(); 78 array->EndDictionary();
83 } 79 }
84 80
85 void DrawingDisplayItem::CloneTo(DrawingDisplayItem* item) const { 81 void DrawingDisplayItem::CloneTo(DrawingDisplayItem* item) const {
86 item->SetNew(picture_); 82 item->SetNew(picture_);
87 } 83 }
88 84
89 size_t DrawingDisplayItem::ExternalMemoryUsage() const { 85 size_t DrawingDisplayItem::ExternalMemoryUsage() const {
90 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); 86 return SkPictureUtils::ApproximateBytesUsed(ToSkPicture(picture_.get()));
91 } 87 }
92 88
93 DISABLE_CFI_PERF 89 DISABLE_CFI_PERF
94 int DrawingDisplayItem::ApproximateOpCount() const { 90 int DrawingDisplayItem::ApproximateOpCount() const {
95 return picture_->approximateOpCount(); 91 return picture_->approximateOpCount();
96 } 92 }
97 93
98 } // namespace cc 94 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/drawing_display_item.h ('k') | cc/test/fake_content_layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698