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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ImageSerializationProcessor* image_serialization_processor) const { | 55 ImageSerializationProcessor* image_serialization_processor) const { |
56 proto->set_type(proto::DisplayItem::Type_ClipPath); | 56 proto->set_type(proto::DisplayItem::Type_ClipPath); |
57 | 57 |
58 proto::ClipPathDisplayItem* details = proto->mutable_clip_path_item(); | 58 proto::ClipPathDisplayItem* details = proto->mutable_clip_path_item(); |
59 details->set_clip_op(SkRegionOpToProto(clip_op_)); | 59 details->set_clip_op(SkRegionOpToProto(clip_op_)); |
60 details->set_antialias(antialias_); | 60 details->set_antialias(antialias_); |
61 | 61 |
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 scoped_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, | 72 const gfx::Rect& canvas_target_playback_rect, |
73 SkPicture::AbortCallback* callback) const { | 73 SkPicture::AbortCallback* callback) const { |
74 canvas->save(); | 74 canvas->save(); |
75 canvas->clipPath(clip_path_, clip_op_, antialias_); | 75 canvas->clipPath(clip_path_, clip_op_, antialias_); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 array->AppendString( | 118 array->AppendString( |
119 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", | 119 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", |
120 visual_rect.ToString().c_str())); | 120 visual_rect.ToString().c_str())); |
121 } | 121 } |
122 | 122 |
123 size_t EndClipPathDisplayItem::ExternalMemoryUsage() const { | 123 size_t EndClipPathDisplayItem::ExternalMemoryUsage() const { |
124 return 0; | 124 return 0; |
125 } | 125 } |
126 | 126 |
127 } // namespace cc | 127 } // namespace cc |
OLD | NEW |