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/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(gfx::RectF clip_rect
)
15 : clip_rect_(clip_rect
) {
18 FloatClipDisplayItem::~FloatClipDisplayItem() {
21 void FloatClipDisplayItem::Raster(SkCanvas
* canvas
,
22 SkDrawPictureCallback
* callback
) const {
24 canvas
->clipRect(gfx::RectFToSkRect(clip_rect_
));
27 bool FloatClipDisplayItem::IsSuitableForGpuRasterization() const {
31 int FloatClipDisplayItem::ApproximateOpCount() const {
35 size_t FloatClipDisplayItem::PictureMemoryUsage() const {
36 return sizeof(gfx::RectF
);
39 void FloatClipDisplayItem::AsValueInto(
40 base::trace_event::TracedValue
* array
) const {
41 array
->AppendString(base::StringPrintf("FloatClipDisplayItem rect: [%s]",
42 clip_rect_
.ToString().c_str()));
45 EndFloatClipDisplayItem::EndFloatClipDisplayItem() {
48 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() {
51 void EndFloatClipDisplayItem::Raster(SkCanvas
* canvas
,
52 SkDrawPictureCallback
* callback
) const {
56 bool EndFloatClipDisplayItem::IsSuitableForGpuRasterization() const {
60 int EndFloatClipDisplayItem::ApproximateOpCount() const {
64 size_t EndFloatClipDisplayItem::PictureMemoryUsage() const {
68 void EndFloatClipDisplayItem::AsValueInto(
69 base::trace_event::TracedValue
* array
) const {
70 array
->AppendString("EndFloatClipDisplayItem");