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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/clip_path_display_item.h" 5 #include "cc/playback/clip_path_display_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
12 #include "cc/proto/display_item.pb.h" 12 #include "cc/proto/display_item.pb.h"
13 #include "cc/proto/skia_conversions.h" 13 #include "cc/proto/skia_conversions.h"
14 #include "third_party/skia/include/core/SkCanvas.h"
15 14
16 namespace cc { 15 namespace cc {
17 16
18 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, 17 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path,
19 bool antialias) 18 bool antialias)
20 : DisplayItem(CLIP_PATH) { 19 : DisplayItem(CLIP_PATH) {
21 SetNew(clip_path, antialias); 20 SetNew(clip_path, antialias);
22 } 21 }
23 22
24 ClipPathDisplayItem::ClipPathDisplayItem(const proto::DisplayItem& proto) 23 ClipPathDisplayItem::ClipPathDisplayItem(const proto::DisplayItem& proto)
(...skipping 30 matching lines...) Expand all
55 54
56 // Just use skia's serialization method for the SkPath for now. 55 // Just use skia's serialization method for the SkPath for now.
57 size_t path_size = clip_path_.writeToMemory(nullptr); 56 size_t path_size = clip_path_.writeToMemory(nullptr);
58 if (path_size > 0) { 57 if (path_size > 0) {
59 std::unique_ptr<uint8_t[]> buffer(new uint8_t[path_size]); 58 std::unique_ptr<uint8_t[]> buffer(new uint8_t[path_size]);
60 clip_path_.writeToMemory(buffer.get()); 59 clip_path_.writeToMemory(buffer.get());
61 details->set_clip_path(buffer.get(), path_size); 60 details->set_clip_path(buffer.get(), path_size);
62 } 61 }
63 } 62 }
64 63
65 void ClipPathDisplayItem::Raster(SkCanvas* canvas, 64 void ClipPathDisplayItem::Raster(PaintCanvas* canvas,
66 SkPicture::AbortCallback* callback) const { 65 PaintRecord::AbortCallback* callback) const {
67 canvas->save(); 66 canvas->save();
68 canvas->clipPath(clip_path_, antialias_); 67 canvas->clipPath(clip_path_, antialias_);
69 } 68 }
70 69
71 void ClipPathDisplayItem::AsValueInto( 70 void ClipPathDisplayItem::AsValueInto(
72 const gfx::Rect& visual_rect, 71 const gfx::Rect& visual_rect,
73 base::trace_event::TracedValue* array) const { 72 base::trace_event::TracedValue* array) const {
74 array->AppendString(base::StringPrintf( 73 array->AppendString(base::StringPrintf(
75 "ClipPathDisplayItem length: %d visualRect: [%s]", 74 "ClipPathDisplayItem length: %d visualRect: [%s]",
76 clip_path_.countPoints(), visual_rect.ToString().c_str())); 75 clip_path_.countPoints(), visual_rect.ToString().c_str()));
77 } 76 }
78 77
79 EndClipPathDisplayItem::EndClipPathDisplayItem() : DisplayItem(END_CLIP_PATH) {} 78 EndClipPathDisplayItem::EndClipPathDisplayItem() : DisplayItem(END_CLIP_PATH) {}
80 79
81 EndClipPathDisplayItem::EndClipPathDisplayItem(const proto::DisplayItem& proto) 80 EndClipPathDisplayItem::EndClipPathDisplayItem(const proto::DisplayItem& proto)
82 : DisplayItem(END_CLIP_PATH) { 81 : DisplayItem(END_CLIP_PATH) {
83 DCHECK_EQ(proto::DisplayItem::Type_EndClipPath, proto.type()); 82 DCHECK_EQ(proto::DisplayItem::Type_EndClipPath, proto.type());
84 } 83 }
85 84
86 EndClipPathDisplayItem::~EndClipPathDisplayItem() { 85 EndClipPathDisplayItem::~EndClipPathDisplayItem() {
87 } 86 }
88 87
89 void EndClipPathDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { 88 void EndClipPathDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
90 proto->set_type(proto::DisplayItem::Type_EndClipPath); 89 proto->set_type(proto::DisplayItem::Type_EndClipPath);
91 } 90 }
92 91
93 void EndClipPathDisplayItem::Raster( 92 void EndClipPathDisplayItem::Raster(
94 SkCanvas* canvas, 93 PaintCanvas* canvas,
95 SkPicture::AbortCallback* callback) const { 94 PaintRecord::AbortCallback* callback) const {
96 canvas->restore(); 95 canvas->restore();
97 } 96 }
98 97
99 void EndClipPathDisplayItem::AsValueInto( 98 void EndClipPathDisplayItem::AsValueInto(
100 const gfx::Rect& visual_rect, 99 const gfx::Rect& visual_rect,
101 base::trace_event::TracedValue* array) const { 100 base::trace_event::TracedValue* array) const {
102 array->AppendString( 101 array->AppendString(
103 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", 102 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]",
104 visual_rect.ToString().c_str())); 103 visual_rect.ToString().c_str()));
105 } 104 }
106 105
107 } // namespace cc 106 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698