OLD | NEW |
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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Just use skia's serialization method for the SkPath for now. | 62 // Just use skia's serialization method for the SkPath for now. |
63 size_t path_size = clip_path_.writeToMemory(nullptr); | 63 size_t path_size = clip_path_.writeToMemory(nullptr); |
64 if (path_size > 0) { | 64 if (path_size > 0) { |
65 std::unique_ptr<uint8_t[]> buffer(new uint8_t[path_size]); | 65 std::unique_ptr<uint8_t[]> buffer(new uint8_t[path_size]); |
66 clip_path_.writeToMemory(buffer.get()); | 66 clip_path_.writeToMemory(buffer.get()); |
67 details->set_clip_path(buffer.get(), path_size); | 67 details->set_clip_path(buffer.get(), path_size); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void ClipPathDisplayItem::Raster(SkCanvas* canvas, | 71 void ClipPathDisplayItem::Raster(SkCanvas* canvas, |
72 const gfx::Rect& canvas_target_playback_rect, | |
73 SkPicture::AbortCallback* callback) const { | 72 SkPicture::AbortCallback* callback) const { |
74 canvas->save(); | 73 canvas->save(); |
75 canvas->clipPath(clip_path_, clip_op_, antialias_); | 74 canvas->clipPath(clip_path_, clip_op_, antialias_); |
76 } | 75 } |
77 | 76 |
78 void ClipPathDisplayItem::AsValueInto( | 77 void ClipPathDisplayItem::AsValueInto( |
79 const gfx::Rect& visual_rect, | 78 const gfx::Rect& visual_rect, |
80 base::trace_event::TracedValue* array) const { | 79 base::trace_event::TracedValue* array) const { |
81 array->AppendString(base::StringPrintf( | 80 array->AppendString(base::StringPrintf( |
82 "ClipPathDisplayItem length: %d visualRect: [%s]", | 81 "ClipPathDisplayItem length: %d visualRect: [%s]", |
(...skipping 17 matching lines...) Expand all Loading... |
100 } | 99 } |
101 | 100 |
102 void EndClipPathDisplayItem::ToProtobuf( | 101 void EndClipPathDisplayItem::ToProtobuf( |
103 proto::DisplayItem* proto, | 102 proto::DisplayItem* proto, |
104 ImageSerializationProcessor* image_serialization_processor) const { | 103 ImageSerializationProcessor* image_serialization_processor) const { |
105 proto->set_type(proto::DisplayItem::Type_EndClipPath); | 104 proto->set_type(proto::DisplayItem::Type_EndClipPath); |
106 } | 105 } |
107 | 106 |
108 void EndClipPathDisplayItem::Raster( | 107 void EndClipPathDisplayItem::Raster( |
109 SkCanvas* canvas, | 108 SkCanvas* canvas, |
110 const gfx::Rect& canvas_target_playback_rect, | |
111 SkPicture::AbortCallback* callback) const { | 109 SkPicture::AbortCallback* callback) const { |
112 canvas->restore(); | 110 canvas->restore(); |
113 } | 111 } |
114 | 112 |
115 void EndClipPathDisplayItem::AsValueInto( | 113 void EndClipPathDisplayItem::AsValueInto( |
116 const gfx::Rect& visual_rect, | 114 const gfx::Rect& visual_rect, |
117 base::trace_event::TracedValue* array) const { | 115 base::trace_event::TracedValue* array) const { |
118 array->AppendString( | 116 array->AppendString( |
119 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", | 117 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", |
120 visual_rect.ToString().c_str())); | 118 visual_rect.ToString().c_str())); |
121 } | 119 } |
122 | 120 |
123 size_t EndClipPathDisplayItem::ExternalMemoryUsage() const { | 121 size_t EndClipPathDisplayItem::ExternalMemoryUsage() const { |
124 return 0; | 122 return 0; |
125 } | 123 } |
126 | 124 |
127 } // namespace cc | 125 } // namespace cc |
OLD | NEW |