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

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

Issue 2710153004: cc: Fix up code to work with concrete cc paint types (Closed)
Patch Set: Rebase 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/display_item_list_unittest.cc ('k') | cc/playback/recording_source_unittest.cc » ('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
(...skipping 28 matching lines...) Expand all
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.
49 if (callback) 49 if (callback) {
50 picture_->playback(canvas, callback); 50 picture_->playback(canvas, callback);
51 else 51 } else {
52 canvas->drawPicture(picture_.get()); 52 // TODO(enne): switch this to playback once PaintRecord is real.
53 canvas->drawPicture(ToSkPicture(picture_.get()));
54 }
53 } 55 }
54 56
55 void DrawingDisplayItem::AsValueInto( 57 void DrawingDisplayItem::AsValueInto(
56 const gfx::Rect& visual_rect, 58 const gfx::Rect& visual_rect,
57 base::trace_event::TracedValue* array) const { 59 base::trace_event::TracedValue* array) const {
58 array->BeginDictionary(); 60 array->BeginDictionary();
59 array->SetString("name", "DrawingDisplayItem"); 61 array->SetString("name", "DrawingDisplayItem");
60 62
61 array->BeginArray("visualRect"); 63 array->BeginArray("visualRect");
62 array->AppendInteger(visual_rect.x()); 64 array->AppendInteger(visual_rect.x());
63 array->AppendInteger(visual_rect.y()); 65 array->AppendInteger(visual_rect.y());
64 array->AppendInteger(visual_rect.width()); 66 array->AppendInteger(visual_rect.width());
65 array->AppendInteger(visual_rect.height()); 67 array->AppendInteger(visual_rect.height());
66 array->EndArray(); 68 array->EndArray();
67 69
68 array->BeginArray("cullRect"); 70 array->BeginArray("cullRect");
69 array->AppendInteger(picture_->cullRect().x()); 71 array->AppendInteger(picture_->cullRect().x());
70 array->AppendInteger(picture_->cullRect().y()); 72 array->AppendInteger(picture_->cullRect().y());
71 array->AppendInteger(picture_->cullRect().width()); 73 array->AppendInteger(picture_->cullRect().width());
72 array->AppendInteger(picture_->cullRect().height()); 74 array->AppendInteger(picture_->cullRect().height());
73 array->EndArray(); 75 array->EndArray();
74 76
75 std::string b64_picture; 77 std::string b64_picture;
76 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture); 78 PictureDebugUtil::SerializeAsBase64(ToSkPicture(picture_.get()),
79 &b64_picture);
77 array->SetString("skp64", b64_picture); 80 array->SetString("skp64", b64_picture);
78 array->EndDictionary(); 81 array->EndDictionary();
79 } 82 }
80 83
81 void DrawingDisplayItem::CloneTo(DrawingDisplayItem* item) const { 84 void DrawingDisplayItem::CloneTo(DrawingDisplayItem* item) const {
82 item->SetNew(picture_); 85 item->SetNew(picture_);
83 } 86 }
84 87
85 size_t DrawingDisplayItem::ExternalMemoryUsage() const { 88 size_t DrawingDisplayItem::ExternalMemoryUsage() const {
86 return SkPictureUtils::ApproximateBytesUsed(ToSkPicture(picture_.get())); 89 return picture_->approximateBytesUsed();
87 } 90 }
88 91
89 DISABLE_CFI_PERF 92 DISABLE_CFI_PERF
90 int DrawingDisplayItem::ApproximateOpCount() const { 93 int DrawingDisplayItem::ApproximateOpCount() const {
91 return picture_->approximateOpCount(); 94 return picture_->approximateOpCount();
92 } 95 }
93 96
94 } // namespace cc 97 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/display_item_list_unittest.cc ('k') | cc/playback/recording_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698