| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void TransformDisplayItem::Raster(SkCanvas* canvas, | 45 void TransformDisplayItem::Raster(SkCanvas* canvas, |
| 46 const gfx::Rect& canvas_target_playback_rect, | 46 const gfx::Rect& canvas_target_playback_rect, |
| 47 SkPicture::AbortCallback* callback) const { | 47 SkPicture::AbortCallback* callback) const { |
| 48 canvas->save(); | 48 canvas->save(); |
| 49 if (!transform_.IsIdentity()) | 49 if (!transform_.IsIdentity()) |
| 50 canvas->concat(transform_.matrix()); | 50 canvas->concat(transform_.matrix()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void TransformDisplayItem::AsValueInto( | 53 void TransformDisplayItem::AsValueInto( |
| 54 const gfx::Rect& visual_rect, |
| 54 base::trace_event::TracedValue* array) const { | 55 base::trace_event::TracedValue* array) const { |
| 55 array->AppendString(base::StringPrintf("TransformDisplayItem transform: [%s]", | 56 array->AppendString(base::StringPrintf( |
| 56 transform_.ToString().c_str())); | 57 "TransformDisplayItem transform: [%s] visualRect: [%s]", |
| 58 transform_.ToString().c_str(), visual_rect.ToString().c_str())); |
| 57 } | 59 } |
| 58 | 60 |
| 59 EndTransformDisplayItem::EndTransformDisplayItem() { | 61 EndTransformDisplayItem::EndTransformDisplayItem() { |
| 60 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, | 62 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, |
| 61 0 /* external_memory_usage */); | 63 0 /* external_memory_usage */); |
| 62 } | 64 } |
| 63 | 65 |
| 64 EndTransformDisplayItem::~EndTransformDisplayItem() { | 66 EndTransformDisplayItem::~EndTransformDisplayItem() { |
| 65 } | 67 } |
| 66 | 68 |
| 67 void EndTransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { | 69 void EndTransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 68 proto->set_type(proto::DisplayItem::Type_EndTransform); | 70 proto->set_type(proto::DisplayItem::Type_EndTransform); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void EndTransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { | 73 void EndTransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
| 72 DCHECK_EQ(proto::DisplayItem::Type_EndTransform, proto.type()); | 74 DCHECK_EQ(proto::DisplayItem::Type_EndTransform, proto.type()); |
| 73 } | 75 } |
| 74 | 76 |
| 75 void EndTransformDisplayItem::Raster( | 77 void EndTransformDisplayItem::Raster( |
| 76 SkCanvas* canvas, | 78 SkCanvas* canvas, |
| 77 const gfx::Rect& canvas_target_playback_rect, | 79 const gfx::Rect& canvas_target_playback_rect, |
| 78 SkPicture::AbortCallback* callback) const { | 80 SkPicture::AbortCallback* callback) const { |
| 79 canvas->restore(); | 81 canvas->restore(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 void EndTransformDisplayItem::AsValueInto( | 84 void EndTransformDisplayItem::AsValueInto( |
| 85 const gfx::Rect& visual_rect, |
| 83 base::trace_event::TracedValue* array) const { | 86 base::trace_event::TracedValue* array) const { |
| 84 array->AppendString("EndTransformDisplayItem"); | 87 array->AppendString( |
| 88 base::StringPrintf("EndTransformDisplayItem visualRect: [%s]", |
| 89 visual_rect.ToString().c_str())); |
| 85 } | 90 } |
| 86 | 91 |
| 87 } // namespace cc | 92 } // namespace cc |
| OLD | NEW |