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/float_clip_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"
10 #include "ui/gfx/skia_util.h"
14 FloatClipDisplayItem::FloatClipDisplayItem() {
17 FloatClipDisplayItem::~FloatClipDisplayItem() {
20 void FloatClipDisplayItem::SetNew(const gfx::RectF
& clip_rect
) {
21 clip_rect_
= clip_rect
;
23 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
24 0 /* external_memory_usage */);
27 void FloatClipDisplayItem::Raster(SkCanvas
* canvas
,
28 const gfx::Rect
& canvas_target_playback_rect
,
29 SkPicture::AbortCallback
* callback
) const {
31 canvas
->clipRect(gfx::RectFToSkRect(clip_rect_
));
34 void FloatClipDisplayItem::AsValueInto(
35 base::trace_event::TracedValue
* array
) const {
36 array
->AppendString(base::StringPrintf("FloatClipDisplayItem rect: [%s]",
37 clip_rect_
.ToString().c_str()));
40 EndFloatClipDisplayItem::EndFloatClipDisplayItem() {
41 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
42 0 /* external_memory_usage */);
45 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() {
48 void EndFloatClipDisplayItem::Raster(
50 const gfx::Rect
& canvas_target_playback_rect
,
51 SkPicture::AbortCallback
* callback
) const {
55 void EndFloatClipDisplayItem::AsValueInto(
56 base::trace_event::TracedValue
* array
) const {
57 array
->AppendString("EndFloatClipDisplayItem");