| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/transform_display_item.h" | 5 #include "cc/playback/transform_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 TransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 36 void TransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 37 DCHECK_EQ(proto::DisplayItem::Type_Transform, proto.type()); | 37 DCHECK_EQ(proto::DisplayItem::Type_Transform, proto.type()); |
| 38 | 38 |
| 39 const proto::TransformDisplayItem& details = proto.transform_item(); | 39 const proto::TransformDisplayItem& details = proto.transform_item(); |
| 40 gfx::Transform transform = ProtoToTransform(details.transform()); | 40 gfx::Transform transform = ProtoToTransform(details.transform()); |
| 41 | 41 |
| 42 SetNew(transform); | 42 SetNew(transform); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void TransformDisplayItem::Raster(SkCanvas* canvas, | 45 void TransformDisplayItem::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 if (!transform_.IsIdentity()) | 48 if (!transform_.IsIdentity()) |
| 50 canvas->concat(transform_.matrix()); | 49 canvas->concat(transform_.matrix()); |
| 51 } | 50 } |
| 52 | 51 |
| 53 void TransformDisplayItem::AsValueInto( | 52 void TransformDisplayItem::AsValueInto( |
| 54 const gfx::Rect& visual_rect, | 53 const gfx::Rect& visual_rect, |
| 55 base::trace_event::TracedValue* array) const { | 54 base::trace_event::TracedValue* array) const { |
| 56 array->AppendString(base::StringPrintf( | 55 array->AppendString(base::StringPrintf( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 69 void EndTransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { | 68 void EndTransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 70 proto->set_type(proto::DisplayItem::Type_EndTransform); | 69 proto->set_type(proto::DisplayItem::Type_EndTransform); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void EndTransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 72 void EndTransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 74 DCHECK_EQ(proto::DisplayItem::Type_EndTransform, proto.type()); | 73 DCHECK_EQ(proto::DisplayItem::Type_EndTransform, proto.type()); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void EndTransformDisplayItem::Raster( | 76 void EndTransformDisplayItem::Raster( |
| 78 SkCanvas* canvas, | 77 SkCanvas* canvas, |
| 79 const gfx::Rect& canvas_target_playback_rect, | |
| 80 SkPicture::AbortCallback* callback) const { | 78 SkPicture::AbortCallback* callback) const { |
| 81 canvas->restore(); | 79 canvas->restore(); |
| 82 } | 80 } |
| 83 | 81 |
| 84 void EndTransformDisplayItem::AsValueInto( | 82 void EndTransformDisplayItem::AsValueInto( |
| 85 const gfx::Rect& visual_rect, | 83 const gfx::Rect& visual_rect, |
| 86 base::trace_event::TracedValue* array) const { | 84 base::trace_event::TracedValue* array) const { |
| 87 array->AppendString( | 85 array->AppendString( |
| 88 base::StringPrintf("EndTransformDisplayItem visualRect: [%s]", | 86 base::StringPrintf("EndTransformDisplayItem visualRect: [%s]", |
| 89 visual_rect.ToString().c_str())); | 87 visual_rect.ToString().c_str())); |
| 90 } | 88 } |
| 91 | 89 |
| 92 } // namespace cc | 90 } // namespace cc |
| OLD | NEW |