Update V8 to version 4.6.62.
[chromium-blink-merge.git] / cc / playback / clip_path_display_item.cc
blobf7fd60626e5447738841624b8aa9a2c77a6a780b
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 // The size of SkPath's external storage is not currently accounted for (and
27 // may well be shared anyway).
28 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
29 0 /* external_memory_usage */);
32 void ClipPathDisplayItem::Raster(SkCanvas* canvas,
33 const gfx::Rect& canvas_target_playback_rect,
34 SkPicture::AbortCallback* callback) const {
35 canvas->save();
36 canvas->clipPath(clip_path_, clip_op_, antialias_);
39 void ClipPathDisplayItem::AsValueInto(
40 base::trace_event::TracedValue* array) const {
41 array->AppendString(base::StringPrintf("ClipPathDisplayItem length: %d",
42 clip_path_.countPoints()));
45 EndClipPathDisplayItem::EndClipPathDisplayItem() {
46 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
47 0 /* external_memory_usage */);
50 EndClipPathDisplayItem::~EndClipPathDisplayItem() {
53 void EndClipPathDisplayItem::Raster(
54 SkCanvas* canvas,
55 const gfx::Rect& canvas_target_playback_rect,
56 SkPicture::AbortCallback* callback) const {
57 canvas->restore();
60 void EndClipPathDisplayItem::AsValueInto(
61 base::trace_event::TracedValue* array) const {
62 array->AppendString("EndClipPathDisplayItem");
65 } // namespace cc