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/resources/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(const gfx::Transform
& transform
)
14 : transform_(transform
) {
17 TransformDisplayItem::~TransformDisplayItem() {
20 void TransformDisplayItem::Raster(SkCanvas
* canvas
,
21 SkDrawPictureCallback
* callback
) const {
23 if (!transform_
.IsIdentity())
24 canvas
->concat(transform_
.matrix());
27 bool TransformDisplayItem::IsSuitableForGpuRasterization() const {
31 int TransformDisplayItem::ApproximateOpCount() const {
35 size_t TransformDisplayItem::PictureMemoryUsage() const {
36 return sizeof(gfx::Transform
);
39 void TransformDisplayItem::AsValueInto(
40 base::trace_event::TracedValue
* array
) const {
41 array
->AppendString(base::StringPrintf("TransformDisplayItem transform: [%s]",
42 transform_
.ToString().c_str()));
45 EndTransformDisplayItem::EndTransformDisplayItem() {
48 EndTransformDisplayItem::~EndTransformDisplayItem() {
51 void EndTransformDisplayItem::Raster(SkCanvas
* canvas
,
52 SkDrawPictureCallback
* callback
) const {
56 bool EndTransformDisplayItem::IsSuitableForGpuRasterization() const {
60 int EndTransformDisplayItem::ApproximateOpCount() const {
64 size_t EndTransformDisplayItem::PictureMemoryUsage() const {
68 void EndTransformDisplayItem::AsValueInto(
69 base::trace_event::TracedValue
* array
) const {
70 array
->AppendString("EndTransformDisplayItem");