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

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

Issue 2751833007: cc: Move DisplayItem::Raster up to DisplayItemList (Closed)
Patch Set: virtualraster: . Created 3 years, 9 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/playback/filter_display_item.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 "third_party/skia/include/core/SkPicture.h"
8
9 #include <string>
10
11 #include "base/strings/stringprintf.h"
12 #include "base/trace_event/trace_event.h"
13 #include "base/trace_event/trace_event_argument.h"
14 #include "base/values.h"
15 #include "cc/debug/picture_debug_util.h"
16 #include "third_party/skia/include/core/SkCanvas.h"
17 #include "ui/gfx/skia_util.h"
18 8
19 namespace cc { 9 namespace cc {
20 10
21 DrawingDisplayItem::DrawingDisplayItem() : DisplayItem(DRAWING) {} 11 DrawingDisplayItem::DrawingDisplayItem() : DisplayItem(DRAWING) {}
22 12
23 DrawingDisplayItem::DrawingDisplayItem(sk_sp<const PaintRecord> record) 13 DrawingDisplayItem::DrawingDisplayItem(sk_sp<const PaintRecord> record)
24 : DisplayItem(DRAWING) { 14 : DisplayItem(DRAWING), picture(std::move(record)) {}
25 SetNew(std::move(record));
26 }
27 15
28 DrawingDisplayItem::DrawingDisplayItem(const DrawingDisplayItem& item) 16 DrawingDisplayItem::DrawingDisplayItem(const DrawingDisplayItem& item)
29 : DisplayItem(DRAWING) { 17 : DisplayItem(DRAWING), picture(item.picture) {}
30 item.CloneTo(this);
31 }
32 18
33 DrawingDisplayItem::~DrawingDisplayItem() { 19 DrawingDisplayItem::~DrawingDisplayItem() = default;
34 }
35
36 void DrawingDisplayItem::SetNew(sk_sp<const PaintRecord> record) {
37 picture_ = std::move(record);
38 }
39
40 DISABLE_CFI_PERF
41 void DrawingDisplayItem::Raster(SkCanvas* canvas,
42 SkPicture::AbortCallback* callback) const {
43 if (canvas->quickReject(picture_->cullRect()))
44 return;
45
46 // SkPicture always does a wrapping save/restore on the canvas, so it is not
47 // necessary here.
48 if (callback) {
49 picture_->playback(canvas, callback);
50 } else {
51 // TODO(enne): switch this to playback once PaintRecord is real.
52 canvas->drawPicture(ToSkPicture(picture_.get()));
53 }
54 }
55
56 void DrawingDisplayItem::CloneTo(DrawingDisplayItem* item) const {
57 item->SetNew(picture_);
58 }
59 20
60 size_t DrawingDisplayItem::ExternalMemoryUsage() const { 21 size_t DrawingDisplayItem::ExternalMemoryUsage() const {
61 return picture_->approximateBytesUsed(); 22 return picture->approximateBytesUsed();
62 } 23 }
63 24
64 DISABLE_CFI_PERF 25 DISABLE_CFI_PERF
65 int DrawingDisplayItem::ApproximateOpCount() const { 26 int DrawingDisplayItem::ApproximateOpCount() const {
66 return picture_->approximateOpCount(); 27 return picture->approximateOpCount();
67 } 28 }
68 29
69 } // namespace cc 30 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/drawing_display_item.h ('k') | cc/playback/filter_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698