Requiem for client_screen.js
[chromium-blink-merge.git] / cc / resources / transform_display_item.cc
bloba25f3478997f7af4cd03a108e6e01501c9721556
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(const gfx::Transform& transform)
14 : transform_(transform) {
17 TransformDisplayItem::~TransformDisplayItem() {
20 void TransformDisplayItem::Raster(SkCanvas* canvas,
21 SkDrawPictureCallback* callback) const {
22 canvas->save();
23 if (!transform_.IsIdentity())
24 canvas->concat(transform_.matrix());
27 bool TransformDisplayItem::IsSuitableForGpuRasterization() const {
28 return true;
31 int TransformDisplayItem::ApproximateOpCount() const {
32 return 1;
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 {
53 canvas->restore();
56 bool EndTransformDisplayItem::IsSuitableForGpuRasterization() const {
57 return true;
60 int EndTransformDisplayItem::ApproximateOpCount() const {
61 return 0;
64 size_t EndTransformDisplayItem::PictureMemoryUsage() const {
65 return 0;
68 void EndTransformDisplayItem::AsValueInto(
69 base::trace_event::TracedValue* array) const {
70 array->AppendString("EndTransformDisplayItem");
73 } // namespace cc