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/resources/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"
13 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath
& clip_path
,
16 : clip_path_(clip_path
), clip_op_(clip_op
), antialias_(antialias
) {
19 ClipPathDisplayItem::~ClipPathDisplayItem() {
22 void ClipPathDisplayItem::Raster(SkCanvas
* canvas
,
23 SkDrawPictureCallback
* callback
) const {
25 canvas
->clipPath(clip_path_
, clip_op_
, antialias_
);
28 bool ClipPathDisplayItem::IsSuitableForGpuRasterization() const {
32 int ClipPathDisplayItem::ApproximateOpCount() const {
36 size_t ClipPathDisplayItem::PictureMemoryUsage() const {
37 size_t total_size
= sizeof(SkPath
) + sizeof(SkRegion::Op
) + sizeof(bool);
41 void ClipPathDisplayItem::AsValueInto(
42 base::trace_event::TracedValue
* array
) const {
43 array
->AppendString(base::StringPrintf("ClipPathDisplayItem length: %d",
44 clip_path_
.countPoints()));
47 EndClipPathDisplayItem::EndClipPathDisplayItem() {
50 EndClipPathDisplayItem::~EndClipPathDisplayItem() {
53 void EndClipPathDisplayItem::Raster(SkCanvas
* canvas
,
54 SkDrawPictureCallback
* callback
) const {
58 bool EndClipPathDisplayItem::IsSuitableForGpuRasterization() const {
62 int EndClipPathDisplayItem::ApproximateOpCount() const {
66 size_t EndClipPathDisplayItem::PictureMemoryUsage() const {
70 void EndClipPathDisplayItem::AsValueInto(
71 base::trace_event::TracedValue
* array
) const {
72 array
->AppendString("EndClipPathDisplayItem");