1 // Copyright 2014 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 #ifndef CC_RESOURCES_CLIP_DISPLAY_ITEM_H_
6 #define CC_RESOURCES_CLIP_DISPLAY_ITEM_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/resources/display_item.h"
13 #include "third_party/skia/include/core/SkRRect.h"
14 #include "ui/gfx/geometry/rect.h"
17 class SkDrawPictureCallback
;
21 class CC_EXPORT ClipDisplayItem
: public DisplayItem
{
23 ~ClipDisplayItem() override
;
25 static scoped_ptr
<ClipDisplayItem
> Create(
27 const std::vector
<SkRRect
>& rounded_clip_rects
) {
28 return make_scoped_ptr(new ClipDisplayItem(clip_rect
, rounded_clip_rects
));
31 void Raster(SkCanvas
* canvas
, SkDrawPictureCallback
* callback
) const override
;
33 bool IsSuitableForGpuRasterization() const override
;
34 int ApproximateOpCount() const override
;
35 size_t PictureMemoryUsage() const override
;
36 void AsValueInto(base::trace_event::TracedValue
* array
) const override
;
39 ClipDisplayItem(gfx::Rect clip_rect
,
40 const std::vector
<SkRRect
>& rounded_clip_rects
);
44 std::vector
<SkRRect
> rounded_clip_rects_
;
47 class CC_EXPORT EndClipDisplayItem
: public DisplayItem
{
49 ~EndClipDisplayItem() override
;
51 static scoped_ptr
<EndClipDisplayItem
> Create() {
52 return make_scoped_ptr(new EndClipDisplayItem());
55 void Raster(SkCanvas
* canvas
, SkDrawPictureCallback
* callback
) const override
;
57 bool IsSuitableForGpuRasterization() const override
;
58 int ApproximateOpCount() const override
;
59 size_t PictureMemoryUsage() const override
;
60 void AsValueInto(base::trace_event::TracedValue
* array
) const override
;
68 #endif // CC_RESOURCES_CLIP_DISPLAY_ITEM_H_