[Do not revert] Roll-back V8 to version 4.4.63.
[chromium-blink-merge.git] / cc / resources / transform_display_item.cc
blob21077158b8c5fea7ff39b81ec498622a721f893a
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"
11 namespace cc {
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 */,
25 memory_usage);
28 void TransformDisplayItem::Raster(SkCanvas* canvas,
29 SkDrawPictureCallback* callback) const {
30 canvas->save();
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 {
51 canvas->restore();
54 void EndTransformDisplayItem::AsValueInto(
55 base::trace_event::TracedValue* array) const {
56 array->AppendString("EndTransformDisplayItem");
59 } // namespace cc