Add @VisibleForTesting to fix ChromePublic release build.
[chromium-blink-merge.git] / cc / playback / transform_display_item.cc
blob1f4e5dbd7339c85ac1ef55253c211c3104bc789a
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 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