| 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 "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
| 9 #include "cc/proto/display_item.pb.h" | 9 #include "cc/proto/display_item.pb.h" |
| 10 #include "cc/proto/skia_conversions.h" | 10 #include "cc/proto/skia_conversions.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (details.has_clip_path()) { | 58 if (details.has_clip_path()) { |
| 59 size_t bytes_read = clip_path.readFromMemory(details.clip_path().data(), | 59 size_t bytes_read = clip_path.readFromMemory(details.clip_path().data(), |
| 60 details.clip_path().size()); | 60 details.clip_path().size()); |
| 61 DCHECK_EQ(details.clip_path().size(), bytes_read); | 61 DCHECK_EQ(details.clip_path().size(), bytes_read); |
| 62 } | 62 } |
| 63 | 63 |
| 64 SetNew(clip_path, clip_op, antialias); | 64 SetNew(clip_path, clip_op, antialias); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ClipPathDisplayItem::Raster(SkCanvas* canvas, | 67 void ClipPathDisplayItem::Raster(SkCanvas* canvas, |
| 68 const gfx::Rect& canvas_target_playback_rect, | |
| 69 SkPicture::AbortCallback* callback) const { | 68 SkPicture::AbortCallback* callback) const { |
| 70 canvas->save(); | 69 canvas->save(); |
| 71 canvas->clipPath(clip_path_, clip_op_, antialias_); | 70 canvas->clipPath(clip_path_, clip_op_, antialias_); |
| 72 } | 71 } |
| 73 | 72 |
| 74 void ClipPathDisplayItem::AsValueInto( | 73 void ClipPathDisplayItem::AsValueInto( |
| 75 const gfx::Rect& visual_rect, | 74 const gfx::Rect& visual_rect, |
| 76 base::trace_event::TracedValue* array) const { | 75 base::trace_event::TracedValue* array) const { |
| 77 array->AppendString(base::StringPrintf( | 76 array->AppendString(base::StringPrintf( |
| 78 "ClipPathDisplayItem length: %d visualRect: [%s]", | 77 "ClipPathDisplayItem length: %d visualRect: [%s]", |
| (...skipping 11 matching lines...) Expand all Loading... |
| 90 void EndClipPathDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { | 89 void EndClipPathDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 91 proto->set_type(proto::DisplayItem::Type_EndClipPath); | 90 proto->set_type(proto::DisplayItem::Type_EndClipPath); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void EndClipPathDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 93 void EndClipPathDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 95 DCHECK_EQ(proto::DisplayItem::Type_EndClipPath, proto.type()); | 94 DCHECK_EQ(proto::DisplayItem::Type_EndClipPath, proto.type()); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void EndClipPathDisplayItem::Raster( | 97 void EndClipPathDisplayItem::Raster( |
| 99 SkCanvas* canvas, | 98 SkCanvas* canvas, |
| 100 const gfx::Rect& canvas_target_playback_rect, | |
| 101 SkPicture::AbortCallback* callback) const { | 99 SkPicture::AbortCallback* callback) const { |
| 102 canvas->restore(); | 100 canvas->restore(); |
| 103 } | 101 } |
| 104 | 102 |
| 105 void EndClipPathDisplayItem::AsValueInto( | 103 void EndClipPathDisplayItem::AsValueInto( |
| 106 const gfx::Rect& visual_rect, | 104 const gfx::Rect& visual_rect, |
| 107 base::trace_event::TracedValue* array) const { | 105 base::trace_event::TracedValue* array) const { |
| 108 array->AppendString( | 106 array->AppendString( |
| 109 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", | 107 base::StringPrintf("EndClipPathDisplayItem visualRect: [%s]", |
| 110 visual_rect.ToString().c_str())); | 108 visual_rect.ToString().c_str())); |
| 111 } | 109 } |
| 112 | 110 |
| 113 } // namespace cc | 111 } // namespace cc |
| OLD | NEW |