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
3 // found in the LICENSE file.
5 #include "cc/playback/transform_display_item.h"
7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/trace_event_argument.h"
9 #include "third_party/skia/include/core/SkCanvas.h"
13 TransformDisplayItem::TransformDisplayItem()
14 : transform_(gfx::Transform::kSkipInitialization
) {
17 TransformDisplayItem::~TransformDisplayItem() {
20 void TransformDisplayItem::SetNew(const gfx::Transform
& transform
) {
21 transform_
= transform
;
23 size_t memory_usage
= sizeof(gfx::Transform
);
24 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
28 void TransformDisplayItem::Raster(SkCanvas
* canvas
,
29 SkDrawPictureCallback
* callback
) const {
31 if (!transform_
.IsIdentity())
32 canvas
->concat(transform_
.matrix());
35 void TransformDisplayItem::AsValueInto(
36 base::trace_event::TracedValue
* array
) const {
37 array
->AppendString(base::StringPrintf("TransformDisplayItem transform: [%s]",
38 transform_
.ToString().c_str()));
41 EndTransformDisplayItem::EndTransformDisplayItem() {
42 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
43 0 /* memory_usage */);
46 EndTransformDisplayItem::~EndTransformDisplayItem() {
49 void EndTransformDisplayItem::Raster(SkCanvas
* canvas
,
50 SkDrawPictureCallback
* callback
) const {
54 void EndTransformDisplayItem::AsValueInto(
55 base::trace_event::TracedValue
* array
) const {
56 array
->AppendString("EndTransformDisplayItem");