| 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/float_clip_display_item.h" | 5 #include "cc/playback/float_clip_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/gfx_conversions.h" | 10 #include "cc/proto/gfx_conversions.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void FloatClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 36 void FloatClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 37 DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type()); | 37 DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type()); |
| 38 | 38 |
| 39 const proto::FloatClipDisplayItem& details = proto.float_clip_item(); | 39 const proto::FloatClipDisplayItem& details = proto.float_clip_item(); |
| 40 gfx::RectF clip_rect = ProtoToRectF(details.clip_rect()); | 40 gfx::RectF clip_rect = ProtoToRectF(details.clip_rect()); |
| 41 | 41 |
| 42 SetNew(clip_rect); | 42 SetNew(clip_rect); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void FloatClipDisplayItem::Raster(SkCanvas* canvas, | 45 void FloatClipDisplayItem::Raster(SkCanvas* canvas, |
| 46 const gfx::Rect& canvas_target_playback_rect, | |
| 47 SkPicture::AbortCallback* callback) const { | 46 SkPicture::AbortCallback* callback) const { |
| 48 canvas->save(); | 47 canvas->save(); |
| 49 canvas->clipRect(gfx::RectFToSkRect(clip_rect_)); | 48 canvas->clipRect(gfx::RectFToSkRect(clip_rect_)); |
| 50 } | 49 } |
| 51 | 50 |
| 52 void FloatClipDisplayItem::AsValueInto( | 51 void FloatClipDisplayItem::AsValueInto( |
| 53 const gfx::Rect& visual_rect, | 52 const gfx::Rect& visual_rect, |
| 54 base::trace_event::TracedValue* array) const { | 53 base::trace_event::TracedValue* array) const { |
| 55 array->AppendString(base::StringPrintf( | 54 array->AppendString(base::StringPrintf( |
| 56 "FloatClipDisplayItem rect: [%s] visualRect: [%s]", | 55 "FloatClipDisplayItem rect: [%s] visualRect: [%s]", |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 void EndFloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { | 67 void EndFloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 69 proto->set_type(proto::DisplayItem::Type_EndFloatClip); | 68 proto->set_type(proto::DisplayItem::Type_EndFloatClip); |
| 70 } | 69 } |
| 71 | 70 |
| 72 void EndFloatClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 71 void EndFloatClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 73 DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type()); | 72 DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type()); |
| 74 } | 73 } |
| 75 | 74 |
| 76 void EndFloatClipDisplayItem::Raster( | 75 void EndFloatClipDisplayItem::Raster( |
| 77 SkCanvas* canvas, | 76 SkCanvas* canvas, |
| 78 const gfx::Rect& canvas_target_playback_rect, | |
| 79 SkPicture::AbortCallback* callback) const { | 77 SkPicture::AbortCallback* callback) const { |
| 80 canvas->restore(); | 78 canvas->restore(); |
| 81 } | 79 } |
| 82 | 80 |
| 83 void EndFloatClipDisplayItem::AsValueInto( | 81 void EndFloatClipDisplayItem::AsValueInto( |
| 84 const gfx::Rect& visual_rect, | 82 const gfx::Rect& visual_rect, |
| 85 base::trace_event::TracedValue* array) const { | 83 base::trace_event::TracedValue* array) const { |
| 86 array->AppendString( | 84 array->AppendString( |
| 87 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]", | 85 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]", |
| 88 visual_rect.ToString().c_str())); | 86 visual_rect.ToString().c_str())); |
| 89 } | 87 } |
| 90 | 88 |
| 91 } // namespace cc | 89 } // namespace cc |
| OLD | NEW |