Pass the affected tree in AXTreeDelegate calls.
[chromium-blink-merge.git] / cc / playback / clip_path_display_item.cc
blobe33166b655211d4b4acec780bd840a2ae2498251
1 // Copyright 2015 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/clip_path_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 ClipPathDisplayItem::ClipPathDisplayItem() {
16 ClipPathDisplayItem::~ClipPathDisplayItem() {
19 void ClipPathDisplayItem::SetNew(const SkPath& clip_path,
20 SkRegion::Op clip_op,
21 bool antialias) {
22 clip_path_ = clip_path;
23 clip_op_ = clip_op;
24 antialias_ = antialias;
26 size_t memory_usage = sizeof(SkPath) + sizeof(SkRegion::Op) + sizeof(bool);
27 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
28 memory_usage);
31 void ClipPathDisplayItem::Raster(SkCanvas* canvas,
32 SkPicture::AbortCallback* callback) const {
33 canvas->save();
34 canvas->clipPath(clip_path_, clip_op_, antialias_);
37 void ClipPathDisplayItem::AsValueInto(
38 base::trace_event::TracedValue* array) const {
39 array->AppendString(base::StringPrintf("ClipPathDisplayItem length: %d",
40 clip_path_.countPoints()));
43 EndClipPathDisplayItem::EndClipPathDisplayItem() {
44 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
45 0 /* memory_usage */);
48 EndClipPathDisplayItem::~EndClipPathDisplayItem() {
51 void EndClipPathDisplayItem::Raster(SkCanvas* canvas,
52 SkPicture::AbortCallback* callback) const {
53 canvas->restore();
56 void EndClipPathDisplayItem::AsValueInto(
57 base::trace_event::TracedValue* array) const {
58 array->AppendString("EndClipPathDisplayItem");
61 } // namespace cc