Update V8 to version 4.6.62.
[chromium-blink-merge.git] / cc / playback / transform_display_item.cc
blobdf7ca1b8e563944ec3cdf8e4ebd35f5afe329e39
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"
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 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
24 0 /* external_memory_usage */);
27 void TransformDisplayItem::Raster(SkCanvas* canvas,
28 const gfx::Rect& canvas_target_playback_rect,
29 SkPicture::AbortCallback* 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 /* external_memory_usage */);
46 EndTransformDisplayItem::~EndTransformDisplayItem() {
49 void EndTransformDisplayItem::Raster(
50 SkCanvas* canvas,
51 const gfx::Rect& canvas_target_playback_rect,
52 SkPicture::AbortCallback* callback) const {
53 canvas->restore();
56 void EndTransformDisplayItem::AsValueInto(
57 base::trace_event::TracedValue* array) const {
58 array->AppendString("EndTransformDisplayItem");
61 } // namespace cc